If you want to use these modules, you must specify the relevant compilation parameters at compile time.
This module allows you to modify the IP address of the client in the request header (such as X-real-ip and X-forwarded-for).
This is useful for some of the nginx that work on the seven-layer http://www.aliyun.com/zixun/aggregation/13996.html ">" "Load Balancer", requests from local IP, However, the proxy server adds the true IP of the client to the request header.
To use this module, you must specify the following compilation parameters at compile time:
--with-http_realip_module
Notice to use: You will create a list of trusted proxies (see below) and the first untrusted IP in the head will act as the client IP (refer to Apache mod_extract).
Sample configuration:
Set_real_ip_from 192.168.1.0/24;set_real_ip_from 192.168.2.1;real_ip_header X-real-ip;
Instructions
Set_real_ip_from
Syntax: Set_real_ip_from [The address| Cidr| " UNIX: "]
Default value: None
Working with fields: HTTP, server, location
This directive specifies the trusted proxy IP that will be forwarded with an exact replacement IP. UNIX sockets can be specified after 0.8.22
Real_ip_header
Syntax: Real_ip_header [x-real-ip| X-forwarded-for]
Default value: Real_ip_header X-real-ip
Working with fields: HTTP, server, location
Set which header you want to use to determine the replacement IP address.