FAQ

Page Discussion Edit History

RuHttpRealIpModule

(Redirected from NginxRuHttpRealIpModule)

Contents

[edit] ngx_http_realip_module

袦芯写褍谢褜 ngx_http_realip_module 锌芯蟹胁芯谢褟械褌 屑械薪褟褌褜 邪写褉械褋 泻谢懈械薪褌邪 薪邪 锌械褉械写邪薪薪褘泄 胁 褋褌褉芯泻械 蟹邪谐芯谢芯胁泻邪 "X-Real-IP" 懈 "X-Forwarded-For". 袩芯 褍屑芯谢褔邪薪懈褞 屑芯写褍谢褜 薪械 褋芯斜懈褉邪械褌褋褟, 薪褍卸薪芯 褉邪蟹褉械褕懈褌褜 械谐芯 褋斜芯褉泻褍 锌褉懈 泻芯薪褎懈谐褍褉懈褉芯胁邪薪懈懈 锌邪褉邪屑械褌褉芯屑 --with-http_realip_module.

The ngx_http_realip_module module enables the user to change the address of the client header lines X-Real-IP and X-Forwarded-For.

This module's not built-in by default, so it is necessary to enable it with the configure option --with-http_realip_module.

小芯写械褉卸邪薪懈械 袩褉懈屑械褉 泻芯薪褎懈谐褍褉邪褑懈懈 袛懈褉械泻褌懈胁褘

袩褉懈屑械褉 泻芯薪褎懈谐褍褉邪褑懈懈

: set_real_ip_from   192.168.1.0/24;
: set_real_ip_from   192.168.2.1;
: real_ip_header     X-Real-IP;

[edit] 袛懈褉械泻褌懈胁褘

  • [#set_real_ip_from set_real_ip_from]
  • [#real_ip_header real_ip_header]

Template:Anchor

[edit] set_real_ip_from

syntax: set_real_ip_from [邪写褉械褋|CIDR]

default: 薪械褌

context: http, server, location

袛懈褉械泻褌懈胁邪 芯锌懈褋褘胁邪械褌 写芯胁械褉械薪薪褘械 邪写褉械褋邪, 泻芯褌芯褉褘械 锌械褉械写邪褞褌 胁械褉薪褘泄 邪写褉械褋 写谢褟 蟹邪屑械薪褘.

Template:Anchor

[edit] real_ip_header

syntax: real_ip_header [X-Real-IP|X-Forwarded-For]

default: real_ip_header X-Real-IP

context: http, server, location

袛懈褉械泻褌懈胁邪 褍泻邪蟹褘胁邪械褌 薪邪蟹胁邪薪懈械 褋褌褉芯泻懈 胁 蟹邪谐芯谢芯胁泻械 蟹邪锌褉芯褋邪, 胁 泻芯褌芯褉芯屑 锌械褉械写邪褢褌褋褟 邪写褉械褋 写谢褟 蟹邪屑械薪褘.

[edit] References

Original Documentation