can't serve port 80 express.js reverse proxy nginx

Ubuntu 14.04. Losing my mind attempting to serve an app on port 80 using nodejs/expressjs. At first I received an "Error: listen EACCESS" error (program exits). This was solved on my local machine by running node as sudo.

On my Linux host, however, even sudo won't prevail, and I get "listen EADDRINUSE" (program exits). Here expressjs is reverse proxied with nginx.

Higher numbered ports don't have any problems (e.g. default 3000)

Abridged version of the node app:

var express = require('express');
var app = express();

var myPort = 80;

app.listen(port, function() {
    console.log("listening on " + parseInt(myPort) + "...");

NGINX config

server {
    listen 80;
    listen [::]:80;

    location / {
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_cache_bypass $http_upgrade;
            try_files $uri $uri/ =404;

Can't for the life of me think of what's already occupying this address? nginx is serving other config files but nothing (it seems?) that touches the loopback address or uses the same domain name. Thanks for any help. Similar issues are touched upon on other SO posts but I wasn't able to find a solution.


You have two processes trying to listen on the same port, which won't work (at least without using SO_REUSEPORT, but that wouldn't make sense in this scenario). Just choose a different port for node and adjust your nginx configuration accordingly.

Need Your Help

Serializing double value to JSON string

c# json javascriptserializer

I'm trying to serialize a double value 1.0 into JSON value 1.0. However, the following code outputs 1 instead of 1.0: