listening on port 80 instead of 3000

66 views
Skip to first unread message

Maurizio Marini

unread,
Jan 28, 2016, 3:04:45 PM1/28/16
to DemocracyOS/app
Hello
I am trying to get democracyos listening on port 80, I changed port from 3000 to 80 and of course I got EADDRINUSE
There is apache on port 80

I have added an ip alias to eth0 and then I have configured development.json wiith this ip and port 80
as here

{
  "jwtSecret": "a5a26c883384a1bc03ba149cf09694df630decd0d4ffa24e18e9b8d505eb7663",
  "protocol": "http",
  "host": "5.39.20.239",
  "publicPort": 80,
  "mongoUrl": "mongodb://localhost/DemocracyOS-dev",
  "locale": "en",
  "organizationName": "DemocracyOS on GitHub",
  "organizationUrl": "https://github.com/DemocracyOS/app"
}

but it still stars on port 3000
It should be enough to change on json config files?

Guido Vilariño

unread,
Jan 28, 2016, 3:13:05 PM1/28/16
to Maurizio Marini, DemocracyOS/app
If port 80 is already in use by another service you won't be able to bind node to it. Also, for binding a process to ports under 1024 you need to run node with administrator privileges

--
You received this message because you are subscribed to the Google Groups "DemocracyOS/app" group.
To unsubscribe from this group and stop receiving emails from it, send an email to democracyos-a...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matías Lescano

unread,
Jan 29, 2016, 8:45:53 AM1/29/16
to DemocracyOS/app, marini....@gmail.com
Also, verify it's not just a configuration problem:
  • Are you sure your NODE_ENV is `development`? To make sure your `development.json` is being loaded.
  • If you have a global environment variable PORT defined, it overrides the `publicPort` option.

Sacha Lifszyc

unread,
Jan 29, 2016, 8:54:50 AM1/29/16
to Matías Lescano, DemocracyOS/app, marini....@gmail.com
Both Matias and Guido are right in what they said. Please check your $PORT and $NODE_ENV env variables.

For further emails, do not send your private key such as `jwtSecret` ;)

Maurizio Marini

unread,
Jan 29, 2016, 12:41:58 PM1/29/16
to DemocracyOS/app, matiasj...@gmail.com, marini....@gmail.com


Il giorno venerdì 29 gennaio 2016 14:54:50 UTC+1, Sacha Lifszyc ha scritto:
Both Matias and Guido are right in what they said. Please check your $PORT and $NODE_ENV env variables.

For further emails, do not send your private key such as `jwtSecret` ;)

On Fri, Jan 29, 2016 at 10:45 AM, Matías Lescano <matiasj...@gmail.com> wrote:
Also, verify it's not just a configuration problem:
  • Are you sure your NODE_ENV is `development`? To make sure your `development.json` is being loaded.
Yes, env | grep NODE_ENV
NODE_ENV=development
 
  • If you have a global environment variable PORT defined, it overrides the `publicPort` option.
 no PORT defined and exported
I managed to have apache not listening on *:80, instead now it listens on 5.39.20.238:80
netstat -anp | grep apache
tcp        0      0 5.39.20.238:80          0.0.0.0:*               LISTEN      16871/apache2
tcp        0      0 5.39.20.238:80          2.238.31.115:54111      ESTABLISHED 17563/apache2
tcp6       0      0 :::8081                 :::*                    LISTEN      16871/apache2
tcp6       0      0 :::8443                 :::*                    LISTEN      16871/apache2
tcp6       0      0 :::443                  :::*                    LISTEN      16871/apache2
tcp6       0      0 5.39.20.238:443         91.252.182.12:4225      ESTABLISHED 17576/apache2

So, there is no reason for throwing an error if want bind socket to 5.39.20.239:80
it seems the error is  about ipv6

  democracyos:notifier:transports Initializing nodemailer API client +9ms
events.js:154
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::80


but as far as I can see using netstat, I have not anything bound  to :::80


thnx for suggestion on secret key :)
Reply all
Reply to author
Forward
0 new messages