請問一下,我的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