We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
要想在程序中取得真实的IP,在执行nginx的configure时,必须指定参数“--with-http_realip_module”, 示例: sudo ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module 然后修改nginx配置文件:
sudo ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module
location / { proxy_pass http://localhost:8080; #后端的web服务器 proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }
重启nginx: ./nginx -s reload 即可。 然后在express服务器里,通过 req.headers['x-real-ip']即可拿到真实ip地址
The text was updated successfully, but these errors were encountered:
No branches or pull requests
要想在程序中取得真实的IP,在执行nginx的configure时,必须指定参数“--with-http_realip_module”,
示例:
sudo ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module
然后修改nginx配置文件:
重启nginx: ./nginx -s reload 即可。
然后在express服务器里,通过 req.headers['x-real-ip']即可拿到真实ip地址
The text was updated successfully, but these errors were encountered: