DEV Community

Discussion on: PM2 listening on port 443 shows EADDRINUSE: address already in use :::443

Collapse
 
codebubb profile image
James Bubb

As the error suggests there is another application that is already bound to port 443. If you're using the Bitnami Node stack I would assume that application would be Apache.

Normally, you would run your application on a local port (e.g. 4000) and then have a reverse proxy (I'm only familiar with Nginx I'm afraid) to make the link between the public web port (e.g. 80 or 443) and your local app, rather than binding your app with pm2 to port 443.

I took a look at some of the documentation for the Bitnami Node.js stack and that is indeed what they suggest doing. docs.bitnami.com/aws/infrastructur...

If you have a look at step 3, they show you how to setup a virtual host for Apache with the reverse proxy to your local Node.js app. It might be worth taking a look at this and revisiting your app setup.

Hope that helps 😀

Collapse
 
dmahely profile image
Doaa Mahely

Hi James, thanks a lot for your input.
Yes, although I wanted to use authbind with pm2 but it seems impossible with no documentation and open issues with no responses.
I've been trying to do something like this where I installed nginx and set up the configuration, but got stuck at the last step where I need to reload Nginx but when I need to run or reload it for the config to be updated.

$ sudo nginx -s reload
nginx: [error] invalid PID number "" in "/run/nginx.pid"
Enter fullscreen mode Exit fullscreen mode

Some of the commands are different because of the different Ubuntu installations. I will check out the link you mentioned and get back to you 🙏

Collapse
 
dmahely profile image
Doaa Mahely

Update: Site is up and running!

I wouldn't have found that page of documentation with that title. Now I learned yet another method of solving this particular problem 😄
Thanks a lot for taking the time to help James!

Thread Thread
 
codebubb profile image
James Bubb

Excellent! Out of interest did you use Nginx in the end or Apache?

Glad it's working for you now.

Thread Thread
 
dmahely profile image
Doaa Mahely

I ended up using Apache and configuring virtual hosts to redirect the traffic, because I couldn't find any complete Nginx tutorials! The Apache method is dead simple and I'm surprised I didn't come across it in my research.

Cheers!