请教以下配置有什么不同?
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;
}
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;
}
第二种可以正确跳转到百度首页,第一种却不行,请问是为什么?
百度服务器拒绝,你可以使设置其他的测试下
两种都可以。
楼主,我也遇到这个问题,求答案或解决方案,第一种URL直接就变成http://baidu_server了