I am looking for help to detect the IP in nginx config http block ( no server block ) I have two IP on same machine and pointing to common nginx. I want to know and find the IP on which incoming request was made to ( not from ),I mean between two IPs which IP received the request.
nginx config http block ip address incoming request listening ip
126 views Asked by user1492502 At
1
You can check the value of
$server_addr
nginx variable, but take into account that it would require an extra system call for every incoming request and produce some extra overhead. It can be better to define two server blocks with two differentlisten
directives, for examplelisten <IP1>:80;
andlisten <IP2>:80;
if you want different behaviour depending on that address.