搜索

首页  >  问答  >  正文

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 还是百度的页面,求指导

天蓬老师天蓬老师2834 天前979

全部回复(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
  • 取消回复