[英]Express js with forever does not listen to external ip
I have uploaded my express js app to my VPS which has static IP. 我已将我的express js应用程序上传到具有静态IP的VPS。
My code that will listen to port and host is this: 我的侦听端口和主机的代码是这样的:
app.listen(8888, "0.0.0.0");
Then I start it with forever: 然后,我将永远永远开始:
forever start main.js
My page is accessible when I open it via localhost, when I try to open via external ip address it doesn't. 当我通过本地主机打开我的页面时,我尝试通过外部ip地址打开它,但无法访问。
Did I miss something? 我错过了什么?
My iptables in Ubuntu Server 14.04 is this: 我在Ubuntu Server 14.04中的iptables是这样的:
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp dpt:bootpc
ACCEPT tcp -- anywhere anywhere tcp dpt:8888
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
The main interesting this is that I can access to this VPS remotely via SSH. 主要有趣的是,我可以通过SSH远程访问此VPS。
Do you have a firewall such as iptables? 您是否有iptables等防火墙? You may need to open your port 8888 if this is the case.
在这种情况下,您可能需要打开端口8888。
sudo iptables -A INPUT -p tcp --dport 8888 -j ACCEPT
Note that this rule will be lost when if your server is restarted. 请注意,如果重新启动服务器,此规则将丢失。 See https://askubuntu.com/questions/66890/how-can-i-make-a-specific-set-of-iptables-rules-permanent
参见https://askubuntu.com/questions/66890/how-can-i-make-a-specific-set-of-iptables-rules-permanent
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.