Forum: NGINX incorrect server address passed to PHP through FastCGI(from nginx version 0.7.36)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E0b6ee5bc98895aad8ea857937b40335?d=identicon&s=25 Kinch Zhang (Guest)
on 2009-03-17 05:06
(Received via mailing list)
Hi, there.

We're using nginx with PHP through FastCGI, and from nginx 0.7.36 on,
the PHP
global variable $_SERVER["SERVER_ADDR"] is always 0.0.0.0, but with the
same PHP
configuration, nginx 0.7.35 passed the correct server address, so I
think
there's a bug in nginx 0.7.36+.

Regards,

Kinch Zhang
F5a6ed477b109fe6acc11a5a8f87e7e8?d=identicon&s=25 mike (Guest)
on 2009-03-17 05:19
(Received via mailing list)
i can validate this.

i was running 0.7.31, i just upgraded to 0.7.42, and it stopped
reporting the right variable.

it is being passed like so:
fastcgi_param SERVER_ADDR $server_addr;

so there is a bug somewhere.
49d68f4402d8f4eba3d3c373d89d1913?d=identicon&s=25 lhmwzy (Guest)
on 2009-03-17 06:38
(Received via mailing list)
so with me.
I am using 0.7.42 and php-fpm.

2009/3/17 mike <mike503@gmail.com>:
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2009-03-17 21:12
(Received via mailing list)
Attachment: patch.server_addr (2 KB)
On Tue, Mar 17, 2009 at 03:56:38AM +0000, Kinch Zhang wrote:

> We're using nginx with PHP through FastCGI, and from nginx 0.7.36 on, the PHP
> global variable $_SERVER["SERVER_ADDR"] is always 0.0.0.0, but with the same PHP
> configuration, nginx 0.7.35 passed the correct server address, so I think
> there's a bug in nginx 0.7.36+.

The attached patch should fix the bug.
2e321cc0efe9422d37165e922298494e?d=identicon&s=25 Cliff Wells (Guest)
on 2009-03-17 21:41
(Received via mailing list)
On Tue, 2009-03-17 at 23:00 +0300, Igor Sysoev wrote:
> On Tue, Mar 17, 2009 at 03:56:38AM +0000, Kinch Zhang wrote:
>
> > We're using nginx with PHP through FastCGI, and from nginx 0.7.36 on, the PHP
> > global variable $_SERVER["SERVER_ADDR"] is always 0.0.0.0, but with the same PHP
> > configuration, nginx 0.7.35 passed the correct server address, so I think
> > there's a bug in nginx 0.7.36+.
>
> The attached patch should fix the bug.
>

Works for me.

Cliff
49d68f4402d8f4eba3d3c373d89d1913?d=identicon&s=25 lhmwzy (Guest)
on 2009-03-18 00:51
(Received via mailing list)
works fine for me too.

2009/3/18 Cliff Wells <cliff@develix.com>:
This topic is locked and can not be replied to.