nginx.conf 配置
proxy_set_header X-Real-IP $proxy_protocol_addr;
proxy_set_header X-Forwarded-For $proxy_protocol_addr;
站点配置
listen 443 ssl http2 proxy_protocol;
server_name example.com;
index index.php index.html index.htm default.php default.htm default.html;
real_ip_recursive on; # 递归处理 PROXY 协议中的 IP 地址
set_real_ip_from 127.0.0.1; # 这里的127.0.0.1表示可信的代理服务器 IP 地址
set_real_ip_from 10.10.1.1/24;
real_ip_header proxy_protocol; # 启用 PROXY 协议支持