/express-nginx-reverse-proxy

Serve ExpressJS app in Nginx server with reverse proxy

Primary LanguageJavaScript

ExpressJS Nginx reverse proxy

Serve ExpressJS app on Nginx web server with reverse proxy

Serve

  1. Serve express app
$ npm start
  1. Add Nginx server block
$ cp express-app /etc/nginx/sites-available/
$ sudo ln -s /etc/nginx/sites-available/express-app /etc/nginx/sites-enabled/
  1. Enable port and restart Nginx
$ sudo iptables -I INPUT 1 -i eth0 -p tcp --dport $port -j ACCEPT
$ sudo systemctl restart nginx

Now the port 8000 running Express app will available on port 80 via Nginx reverse proxy