码迷,mamicode.com
首页 > 其他好文 > 详细

Nginx-8.nginx反向代理监控虚拟IP地址

时间:2020-06-23 19:09:56      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:RoCE   nec   proc   重启   conf   代理   netstat   ddr   反向   

一、 编写nginx反向代理配置

worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream myserver {
server 10.0.0.7:80;
server 10.0.0.8:80;
server 10.0.0.9:80;
}
server {
listen 10.0.0.3:80;
server_name www.example.com;
root html;
index index.html index.htm;
location / {
proxy_pass http://myserver;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
}

二、 监听本地网卡上没有的IP地址

echo ‘net.ipv4.ip_nonlocal_bind = 1‘ >>/etc/sysctl.conf

此操作我的模板机已进行优化,但不保证其他机器也会优化,所以写上

sysctl -p

三、 重启服务

[root@xxx~]# nginx -s stop
[root@xxx~]# nginx
[root@xxx~]# netstat -lntup|grep nginx
tcp 0 0 10.0.0.3:80 0.0.0.0:* LISTEN 53334/nginx

Nginx-8.nginx反向代理监控虚拟IP地址

标签:RoCE   nec   proc   重启   conf   代理   netstat   ddr   反向   

原文地址:https://www.cnblogs.com/Wang-Hongwei/p/13183625.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!