27 April, 2020

NGINX

liton

338 views


Nging reverse proxy configuration

Tested for nginx/1.11.8

The http_realip_module must be installed (--with-http_realip_module), of course !

Use this command to check :

2>&1 nginx -V | tr -- - '\n' | grep http_realip_module
  • We need to tell the reverse proxy to pass information to the backend nginx server.
  • We can add thoses lines as a global configuration or per location.
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;