Forum: NGINX bug with variables in fastcgi_pass

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.
Samuel Vogel (Guest)
on 2008-12-17 01:54
(Received via mailing list)
Hey Igor,

I think I have hit a bug while trying out the feature you added in
0.7.27.

My config looks like this:
server {
    listen 127.0.0.1:81;
    server_name _;

    access_log  /var/log/nginx/access.log;

    set $subdir "default";

    if ($host ~ "^(.+)\.user\.domain\.net$") {
        set $subdir $1;
    }

    root   /www/$subdir;
    index  index.php index.html index.htm;

    location ~ \.php$ {
        fastcgi_pass   unix:/var/run/php-fpm/socket-$subdir;
    }
}


And I get the following error:
[error] 17238#0: *1 no resolver defined to resolve
/var/run/php-fpm/socket-345232, client: 127.0.0.1, server: _, request:
"GET /info.php HTTP/1.1", host: "345232.user.domain.net"

If I remove the variable from fastcgi_pass everything works fine!
It seems like nginx is ignoring that I try to point it to a unix socket,
when I use a variable!

Regards,
Samy
Samuel Vogel (Guest)
on 2008-12-22 16:38
(Received via mailing list)
Samuel Vogel schrieb:
>
>    }
> socket, when I use a variable!
>
> Regards,
> Samy

Hey Igor,

I have just tried to 0.7.26 with the patch you sent to the list and I do
get the exact same error:

2008/12/22 14:05:45 [error] 23482#0: *2 no resolver defined to resolve
/var/run/php-fpm/socket-345232, client: 127.0.0.1, server: _, request:
"GET /info.php HTTP/1.1", host: "345232.user.domain.net"

Maybe this helps to isolate the issue a bit!

Regards,
Samy
Igor S. (Guest)
on 2008-12-22 16:43
(Received via mailing list)
On Mon, Dec 22, 2008 at 03:25:04PM +0100, Samuel Vogel wrote:

> >     access_log  /var/log/nginx/access.log;
> >       fastcgi_pass   unix:/var/run/php-fpm/socket-$subdir;
> >It seems like nginx is ignoring that I try to point it to a unix
> 2008/12/22 14:05:45 [error] 23482#0: *2 no resolver defined to resolve
> /var/run/php-fpm/socket-345232, client: 127.0.0.1, server: _, request:
> "GET /info.php HTTP/1.1", host: "345232.user.domain.net"
>
> Maybe this helps to isolate the issue a bit!

fastcgi_pass currently does not support variables for unix sockets:
it tries to resolve it as domain name. I will try to fix the bug before
vacantion.
Samuel Vogel (Guest)
on 2008-12-22 18:46
(Received via mailing list)
Igor S. schrieb:
>>> My config looks like this:
>>>
>>> /var/run/php-fpm/socket-345232, client: 127.0.0.1, server: _, request:
>>
> fastcgi_pass currently does not support variables for unix sockets:
> it tries to resolve it as domain name. I will try to fix the bug before
> vacantion
This would be great, since this is what we need the variable support
for!
Thanks!

Regards,
Samy
Igor S. (Guest)
on 2008-12-22 19:16
(Received via mailing list)
Attachment: patch.unix.vars (0 Bytes)
On Mon, Dec 22, 2008 at 05:24:23PM +0100, Samuel Vogel wrote:

> >>>
> >>>  }
> >>>[error] 17238#0: *1 no resolver defined to resolve
> >>Hey Igor,
> >
> >fastcgi_pass currently does not support variables for unix sockets:
> >it tries to resolve it as domain name. I will try to fix the bug before
> >vacantion
> This would be great, since this is what we need the variable support for!

The attached patch allows to use variables in unix sockets path
in fastcgi_pass and proxy_pass.
Samuel Vogel (Guest)
on 2008-12-23 00:27
(Received via mailing list)
Igor S. schrieb:
> The attached patch allows to use variables in unix sockets path
> in fastcgi_pass and proxy_pass.
>
Thanks Igor! Greatly appreciate it.
I have already tried the patch out and it works flawlessly!
It is also great that the patch also supports proxy_pass!

Regards,
Samy
This topic is locked and can not be replied to.