hosting express server with nginx

hkisthebest asked:

I want to host my express website with nginx on aws. So I followed this tutorial, but replacing the express app with my own app, and after changing the port to the same as my express app, I fired up my node app, it said the port has been used Error: listen EADDRINUSE :::8000.

My Express app is at /usr/share/nginx/html/mysite

Am I misunderstanding something?

My nginx.conf:

server {
listen 80;
server_name my_public_ip;
location / {
proxy_pass http://localhost:8000;
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;
}
}

If this isn’t the right place to ask, sorry, please let me know, thanks.

My answer:


You’re already running some program that listens on port 8000. You have to stop it first, before you can start another one.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.