Skip to content

NodeJS Nginx Reverse Proxy

You can follow the guides below to install and configure Nginx and NodeJS

  1. Nginx Installation on Centos and Ubuntu
  2. NodeJS Installation on Centos and Ubuntu
  3. Assuming the NodeJS application is running on PORT->3000

Server Block Configuration for NodeJS Nginx Reverse Proxy

upstream skydevops_upstream {
	server 127.0.0.1:3000;
	keepalive 64;
}

server {
	listen 80;
	server_name nodejs.yebbare.com;
	root /home/shashi/;

	location / {
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header Host $http_host;
		proxy_set_header X-NginX-Proxy true;
		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
		proxy_max_temp_file_size 0;
		proxy_pass http://skydevops_upstream/;
		proxy_redirect off;
		proxy_read_timeout 240s;
	}
}

Shashi View All

A passionate devops and automation engineer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: