nginx proxy real ip code example
Example 1: ngingx proxy express get real ip
1) app.set('trust proxy', true) in your Express app.
2) Add proxy_set_header X-Forwarded-For $remote_addr in
the Nginx configuration for your server block.
// sudo nano /etc/nginx/sites-available/default
Example 2: nginx set header x-real-ip
proxy_set_header X-Real-IP $remote_addr;
Example 3: pass proxy nginx
location ~ \.php {
proxy_pass http://127.0.0.1:8000;
}