How to expose the app to the world

Since your app will start under a non-privileged user, you can't just config:set PORT=80. Therefore, if you want to expose your application to the world on port 80 or 443, you can either use Apache or Nginx to proxy the incoming requests on port 80 to the port on which your app listens:

Apache (debian)

# install apache
sudo apt-get install -y apache2
# enabled required modules
sudo a2enmod proxy_http
# setup apache configuration
cat > /etc/apache2/sites-available/default <<EOF
<VirtualHost *:80>
  <Location />
    ProxyPass http://localhost:6000/
# restart apache
sudo service apache2 restart

Nginx (debian)

# install nginx
sudo apt-get install -y nginx
# setup nginx configuration
cat > /etc/nginx/sites-available/default <<EOF
server {
  listen          80;
  location / {
    proxy_pass      http://localhost:6000;
# restart nginx
sudo service nginx restart


You can also quickly achieve the same result by adding a few iptable rules, such as:

sudo iptables -A PREROUTING -t nat -p tcp --dport 80 -j REDIRECT --to-port 6000
sudo iptables -t nat -I OUTPUT -p tcp -d --dport 80 -j REDIRECT --to-ports 6000

Note that iptable rules will not survive a reboot, so the Apache or Nginx approach is recommended.