• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Cannot make nodejs application listen on different port

proton23

Basic Pleskian
Server operating system version
Ubuntu 20.04.6 LTS
Plesk version and microupdate number
Plesk Obsidian 18.0.52
Hello,
I was finally able to make openhab cloud work.
The application is listening on port 3000 and I would like to change this since Dr.Web is using this port.
The code of app.js contains this line.
JavaScript:
app.set('port', process.env.PORT || 3000);
I tried to set env variable PORT to 3001, without any change.
Even if I change it to
JavaScript:
app.set('port', 3001);
the app will always start on port 3000

Is there a way to tell a nodejs app witch port to listen to, on start up?

Best regards
 
Thanks for the reply!
I'm not quite sure how this is supposed to work.
Isn't
JavaScript:
app.set('port', process.env.PORT || 3000);
nearly what was suggested in the article?
And where will the port be set?

Best regards
 
So the support fixed my problem but in a different way. Not the port of the node.js application was changed but the port of the Plesk Antivirus Service.
Since it can break every time through an update they told me how to fix it.
Bash:
 grep -R 2999 /etc/drweb/
/etc/drweb/drweb_handler.conf:Address = inet:2999@localhost
/etc/drweb/drweb32.ini:Socket = 2999, localhost
With this changes drweb is now listening on port 2999.

Best regards
 
Back
Top