Get the IP of the current nginx server and pass it to the redirected page
PHP中文网
PHP中文网 2017-05-16 17:17:40
0
1
472

Use rewrite to jump. I want to know if I can get the IP of the current nginx server and pass it to the jumped page. There are multiple nginx servers used for diversion, so it is not easy to use hard coding

rewrite ^/(.*)$ http://xxx/a.php?id=/ permanent;
PHP中文网
PHP中文网

认证0级讲师

reply all(1)
大家讲道理

It is recommended to pass the hostname, which nginx supports nginx_doc. Of course, the premise is that the hostname in the cluster is unique.

If you have to pass the IP, it’s not impossible, but it requires a little magic.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template