Someone else suggested:<div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">fastcgi_param UPS_SERVER_ADDR $upstream_addr;<br><br>and get $_SERVER[&quot;UPS_SERVER_ADDR&quot;].</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">?</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font><br><div class="gmail_quote">On Tue, Oct 12, 2010 at 2:26 AM, Maxim Dounin <span dir="ltr">&lt;<a href="mailto:mdounin@mdounin.ru">mdounin@mdounin.ru</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello!<br>
<div><div></div><div class="h5"><br>
On Mon, Oct 11, 2010 at 09:41:32PM -0400, Ilan Berkner wrote:<br>
<br>
&gt; Hi All,<br>
&gt;<br>
&gt; We&#39;re doing some profiling and one of the parameters we&#39;d like to get is the<br>
&gt; IP address of the fastcgi (in this case php-fpm) server that processed the<br>
&gt; request.  PHP $_SERVER[&#39;server_addr&#39;] returns the external address of the<br>
&gt; nginx server per our fastcgi configuration:<br>
&gt;<br>
&gt; fastcgi_param  SERVER_ADDR        $server_addr;<br>
&gt;<br>
&gt; Is this correct behavior? is there a way to get the local address of the<br>
&gt; server processing the php request?<br>
<br>
</div></div>Yes, SERVER_ADDR is expected to contain http server address, not<br>
the address of fastcgi application.<br>
<br>
Moreever, upstream&#39;s address (fastcgi application address in your<br>
case) isn&#39;t available when nginx creates request to upstream (as<br>
particular upstream server isn&#39;t selected yet, and even after<br>
selection it may change due to proxy_next_upstream).<br>
<br>
You should be able to find out fastcgi application&#39;s address in<br>
fastcgi application itself, it&#39;s just a matter of calling<br>
getpeername() on connection socket.  Not idea how to do it in php<br>
though.<br>
<br>
Maxim Dounin<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div><br></div>