nginx upstream proxy_pass problem
伊谢尔伦
伊谢尔伦 2017-05-16 17:21:19
0
3
371

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?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!