Skip to content

Instantly share code, notes, and snippets.

@tusharf5
Created August 19, 2019 20:47
Show Gist options
  • Save tusharf5/5a360f9f435aa05f099ca64c87942a5f to your computer and use it in GitHub Desktop.
Save tusharf5/5a360f9f435aa05f099ca64c87942a5f to your computer and use it in GitHub Desktop.
Production Ready Nginx as Reverse Proxy Configuration for Node API
user nginx;
worker_processes auto;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
error_log /dev/null;
access_log /dev/null;
include /etc/nginx/mime.types;
default_type application/octet-stream;
upstream express_server {
server 127.0.0.1:3001;
keepalive 64;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_pass http://express_server/;
proxy_redirect off;
proxy_read_timeout 240s;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment