search

Home  >  Q&A  >  body text

Get the IP of the current nginx server and pass it to the redirected page

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中文网2754 days ago458

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理2017-05-16 17:19:40

    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.

    reply
    0
  • Cancelreply