请问一下,我的nginx只能运行在非80端口
那么我如何将域名转发到这个非80端口上
例如下面:
listen 8000;
server_name abc.test www.abc.test;
location / {
root /home/www/abc.test;
index index.html index.htm;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
if ($http_host = "www.abc.test") {
proxy_pass http://127.0.0.1:8000;
}
if ($http_host = "abc.test") {
proxy_pass http://127.0.0.1:8000;
}
仅有的幸福2017-05-16 17:22:42
你的Nginx监听了8000端口,那么就要想办法把80端口转发过来,类似于:
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080