我用nginx代理到gateway的,$_SERVER['REMOTE_ADDR'] 获取到的是127.0.0.1 不是客户端的ip,
nginx配置如下:
location /GatewayWorker
{
proxy_pass http://127.0.0.1:8282;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Real-IP $remote_addr;
}
然后gateway的
$_SERVER['REMOTE_ADDR'] 获取到的永远是127.0.0.1
求老师指导
参考手册 http://doc.workerman.net/faq/get-real-ip-from-proxy.html
谢谢 已解决