Nginx Related Tips and Configurations

For nginx, On most systems,

Basic Nginx Config

This is the most basic nginx config where proxy_pass & server_name values need to be modified and it should work in most applications. This config already passes the real IP in the proxy_set_header value and it can be commented out by putting a # in the beginning of the line to disable.

server {
    listen 80;
    server_name www.example.com example.com;

    location / {

        proxy_pass http://localhost:2000;
        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;
        proxy_set_header X-Forwarded-For $remote_addr;
    }

}
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9