nginx相关
1.nginx 配置反向代理
upstream server1 {
server 192.168.3.83:81;
} # 必须在http 模块中
server {
listen 80;
server_name test.81.com;
location / {
proxy_pass http://server1;
index index.html index.htm;
}
listen 80;
server_name test.81.com;
location / {
proxy_pass http://server1;
index index.html index.htm;
}
} # 注意:配置反向代理的server 和其他server是平行的
2.nginx 配置负载均衡
upstream test.81.com {
server 192.168.3.83:81;
server 192.168.3.89:81;
}
server 192.168.3.83:81;
server 192.168.3.89:81;
}
#loader banners
server{
listen 80;
server_name test.81.com;
location /{
proxy_pass http://test.81.com; # 做代理
proxy_set_header Host $host; #
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_X_Forwarded-for;
}
server{
listen 80;
server_name test.81.com;
location /{
proxy_pass http://test.81.com; # 做代理
proxy_set_header Host $host; #
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_X_Forwarded-for;
}
本文来自博客园,作者:鱼丸粗面没鱼丸,转载请注明原文链接:https://www.cnblogs.com/Robi-9662/p/9719052.html