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
My guess is that
host
there is no corresponding binding addedReverse proxy is a proxy set on the server side. When you visit Baidu, of course it is still a Baidu page.
Bind hosts, /etc/hosts