合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
配置nginx.conf,如下: 负载均衡配置: upstream tomcatserver1 { server 192.168.72.49:8081; } upstream tomcatserver2 { server192.168.72.49:8082; } server { listen 80; server_name test8081.com; #charset koi8-r; #access_log logs/test8081.com.log main; location / { proxy_pass http://tomcatserver1; //反向代理服务器的地址,可以直接填写地址如proxy_pass http://47.95.220.171; 1. proxy\_set\_header X-Real-IP $remote\_addr; # 获取客户端真实IP proxy\_set\_header REMOTE-HOST $remote\_addr; # 获取客户端浏览器的主机名 proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for; # 获取代理者的真实ip proxy_set_header X-Forwarded-Proto $scheme;获取代理者http协议 proxy_set_header X-FORWARDED-NAME $server_name; 域名 proxy_set_header X-FORWARDED-PORT $server_port;端口 index index.html index.htm; } } server { listen 80; server_name test8082.com; #charset koi8-r; #access_log logs/test8082.com.log main; location / { proxy_pass http://tomcatserver2; index index.html index.htm; } }