0👍
Nginx is now in charge of ports 80 and 443.
Set your express app to listen to some port, let’s say 8080.
app.listen(8080, function(){
});
Find your nginx config file. I’m using the default file found under nginx/sites-available
Edit the default server block to this
server { # simple reverse-proxy
listen 80;
server_name _;
location / {
proxy_pass http://127.0.0.1:8080;
}
}
Nginx will now forward requests to your node app.
Source:stackexchange.com