Question

<sickyjim> hi all, I’m trying to run an app on port 80 instead of 1337 but when I change the port in config/env/production, the app launches but I can’t reach it from a browser :/

Answer

This could be caused by a couple of things. We’ll go through each and every one of them. If it’s still not working for you, leave a comment down below and I’ll update the list with more checks.

Port 80 < 1024

When running an application on a port < 1024, you’ll need su access. These ports are “special”, and thus protected behind sudo.

Now please don’t run your application on sudo. In stead, run it on any port > 1024, and in your firewall forward port 80 to the chosen port. For this example I’ve chosen the default port 1337.

Port in use

Something else might be using port 80. Common ones are:

  • Apache – sudo apachectl stop
  • Nginx – nginx -s stop
  • Skype – preferences > Advanced: Change Incoming connections port

If all else prevails, run the following command (for your OS) to find out what’s running on port 80:

MacOS: sudo lsof -i ':80'

Linux: netstat -tulpn | grep :80

SPI protection

It might also be SPI firewall protection blocking your application from functioning. You can read more about that here: SPI Firewall protection on router.