I have uploaded my express js app to my VPS which has static IP.
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.
Did I miss something?
My iptables in Ubuntu Server 14.04 is this:
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.
Do you have a firewall such as iptables? You may need to open your port 8888 if this is the case.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.