NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
# nginx反向代理监控虚拟IP地址 [toc] ## 一、 编写nginx反向代理配置 ```sh server { listen 10.0.0.3:80; server_name www.etiantian.org; root html; index index.html index.htm; location / { proxy_pass http://noah; proxy_set_header host $host; proxy_set_header X-Forwarded-For $remote_addr; } } server { listen 10.0.0.3:80; server_name bbs.etiantian.org; root html; index index.html index.htm; location / { proxy_pass http://noah; proxy_set_header host $host; proxy_set_header X-Forwarded-For $remote_addr; } } ``` ## 二、 监听本地网卡上没有的IP地址 ```sh echo 'net.ipv4.ip_nonlocal_bind = 1' >>/etc/sysctl.conf #此操作我的模板机已进行优化,但不保证其他机器也会优化,所以写上 sysctl -p ``` ## 三、 重启服务 ```sh [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 ```