Nginx不保留wordpress proxy_pass的域名

在我的/etc/hosts文件中,我添加了一个别名到localhost,像这样:
127.0.0.1 example.local

我的WordPress的服务器端口8000托pipe,所以我使用proxy_pass

 server{ listen 80; server_name example.local; root /Users/akashagarwal/Downloads/wordpress; location / { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; } } 

我面临两个问题。
1.在浏览器中打开http://example.local后,地址栏会附加:8000
2.点击链接后,主机名变为localhost:8000
我在这里做错了什么?

macOS Sierra 10.12.1上运行nginx version: nginx/1.10.3
TIA

这个问题肯定不是nginx:你的应用程序正在重写客户端访问它所知道的主机名。 寻找nginx日志,我打赌有几个30x代码日志,redirect你莫名其妙,…

你的configuration是指Wordpress,我猜你应该添加到你的wp-config.php ,像这样 :

 define('WPSITEURL','http://example.local/'); define('WPHOME','http://example.local/');