Heim  >  Fragen und Antworten  >  Hauptteil

Die Nginx-Konfiguration als Reverse-Proxy ist fehlgeschlagen

Fügen Sie den folgenden Code zu nginx.conf hinzu:

# node test
server {
    listen 80;
    server_name www.baidu.com;
    location /{
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
    }
}

In http{} 中,位置应该没问题,localhost:8000 能够启动,然后 start nginx öffnen Sie www.baidu.com oder die Baidu-Seite und fragen Sie bitte nach Anleitung

天蓬老师天蓬老师2714 Tage vor910

Antworte allen(3)Ich werde antworten

  • 黄舟

    黄舟2017-05-16 17:12:42

    猜测是host里面没添加对应的绑定

    Antwort
    0
  • 習慣沉默

    習慣沉默2017-05-16 17:12:42

    反向代理,是在服务端设置的代理。你访问百度,当然还是百度的页面。

    Antwort
    0
  • PHPz

    PHPz2017-05-16 17:12:42

    绑定hosts ,/etc/hosts

    Antwort
    0
  • StornierenAntwort