How do I get my server to run forever publicly?

May 31, 2015 3k views
Node.js DNS DigitalOcean

I have a node app and I can run it on localhost as [IP ADDRESS]:3000, but how do I get it to run forever just as [IP ADDRESS]? A little confused on how this works

4 Answers

Browsers default to port 80 for HTTP and 443 for HTTPS, changing your server's port (whether it's Node.js or something else) to port 80 should do the trick.

You can use apache, nginx, haproxy, or the like and reverse proxy from [IP ADDRESS] -> [INTERNAL IP]:3000 (With Internal IP being locally - You can also change the port of your app to make it use 80 so when someone enters the IP (or domain if its an A record) it will go to the web page of your app without having to define the port within the URL

Node.js is an open source Javascript runtime environment for easily building server-side and networking applications. The platform runs on Linux, OS X, FreeBSD, and Windows, and its applications are written in JavaScript. Node.js applications can be run at the command line but we will...
  • Yes, that would work very well for what you are trying to do. I would recommend using nginx or haproxy over apache too.

Great, thanks for the recommendation and help!

Have another answer? Share your knowledge.