What are the differences between the following configurations?
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;
}
The second one can jump to the Baidu homepage correctly, but the first one does not. Why?
Baidu server rejects, you can set other tests
Both are fine.
Owner, I also encountered this problem. Please give me an answer or solution. The first URL directly becomes http://baidu_server