[英]Forward Port from 80 & 443 to 8080
I tried to forward port 80 & 443 to 8080 on a server that I am working on https://www.neptos.io 我尝试将端口80和443转发到我正在使用https://www.neptos.io的服务器上的8080
My Angular Universal app is running on 8080 but my default angular app is running on port 80 & 443 (https) 我的Angular Universal应用程序在8080上运行,但我的默认angular应用程序在端口80和443(https)上运行
I forwarded both port 80 and 443 to 8080 via iptables using: 我使用以下命令通过iptables将端口80和443转发到8080:
iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 8080
iptables -t nat -A OUTPUT -o lo -p tcp --dport 443 -j REDIRECT --to-port 8080
Now when I ssh into the remote machine and run curl localhost, I get the desired result which is the angular universal app but when I open, it in a browser https://www.neptos.io I get the default angular app. 现在,当我使用SSH进入远程计算机并运行curl localhost时,会得到所需的结果,即Angle通用应用程序,但是当我打开它时,在浏览器https://www.neptos.io中将其获取默认的angular应用程序。
Am i doing something wrong here? 我在这里做错什么了吗?
Any help would be appreciated. 任何帮助,将不胜感激。
I believe the OUTPUT chain will only effect traffic generated on the localhost. 我相信OUTPUT链只会影响在本地主机上生成的流量。 To redirect incoming traffic you need to use the PREROUTING chain.
要重定向传入流量,您需要使用PREROUTING链。
iptables -t nat -I PREROUTING --src 0/0 --dst 127.0.0.1 -p tcp --dport 80 -j REDIRECT --to-ports 8080
Just replace the localhost ip with what ever your interface IP is 只需用您的接口IP替换localhost ip
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.