Home  >  Q&A  >  body text

nginx configuration as reverse proxy failed

Add the following code to 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;
    }
}

In http{}, the location should be ok, localhost:8000 can be started, then start nginx, open www.baidu.com or Baidu page, please guide

天蓬老师天蓬老师2714 days ago905

reply all(3)I'll reply

  • 黄舟

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

    My guess is that hostthere is no corresponding binding added

    reply
    0
  • 習慣沉默

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

    Reverse proxy is a proxy set on the server side. When you visit Baidu, of course it is still a Baidu page.

    reply
    0
  • PHPz

    PHPz2017-05-16 17:12:42

    Bind hosts, /etc/hosts

    reply
    0
  • Cancelreply