首頁  >  問答  >  主體

nginx 設定做反向代理不成功

在 nginx.conf 加入以下程式碼:

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

http{} 中,位置應該沒問題,localhost:8000 能夠啟動,然後start nginx,打開www.baidu.com 還是百度的頁面,求指導

天蓬老师天蓬老师2714 天前906

全部回覆(3)我來回復

  • 黄舟

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

    猜測是host裡面沒加對應的綁定

    回覆
    0
  • 習慣沉默

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

    反向代理,是在服務端設定的代理。你造訪百度,當然還是百度的頁面。

    回覆
    0
  • PHPz

    PHPz2017-05-16 17:12:42

    綁定hosts ,/etc/hosts

    回覆
    0
  • 取消回覆