Nginx-Upstream-Proxy-Pass-Problem
伊谢尔伦
伊谢尔伦 2017-05-16 17:21:19
0
3
523

Was sind die Unterschiede zwischen den folgenden Konfigurationen?

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;
    }

Die zweite Methode kann korrekt zur Baidu-Homepage springen, aber die erste Methode funktioniert nicht. Darf ich fragen, warum?

伊谢尔伦
伊谢尔伦

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

Antworte allen(3)
Ty80

百度服务器拒绝,你可以使设置其他的测试下

某草草

两种都可以。

PHPzhong

楼主,我也遇到这个问题,求答案或解决方案,第一种URL直接就变成http://baidu_server了

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage