作者:alloyer | 来源:互联网 | 2023-10-13 15:35
请教以下配置有什么不同?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| upstream baidu_server {
server 180.149.132.47:80;
}
server {
listen 80;
server_name xxx.example.com;
charset utf-8;
access_log off;
location / {
proxy_redirect off;
proxy_pass http://baidu_server;
proxy_set_header User-Agent $http_user_agent;
proxy_set_header Accept-Encoding "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} |
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| server {
listen 80;
server_name xxx.example.com;
charset utf-8;
access_log off;
location / {
proxy_redirect off;
proxy_pass http://180.149.132.47:80;
proxy_set_header User-Agent $http_user_agent;
proxy_set_header Accept-Encoding "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} |
第二种可以正确跳转到百度首页,第一种却不行,请问是为什么?