Forum: NGINX Using Variable 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-10-20 18:33
(Received via mailing list)
Hey,

I am trying to use a variable in the fastcgi_pass directive. It does not
get parsed however.

Example:
2008/10/20 12:09:59 [crit] 4475#0: *3 connect() to
unix:/var/run/php-fpm/socket/$userid failed (2: No such file or
directory) while connecting to upstream, client: 127.0.0.1, server:
localhost, request: "GET /info.php HTTP/1.1", upstream:
"fastcgi://unix:/var/run/php-fpm/socket/$userid:", host:
"345232.user.domain.net"

Is this not supported? It would be a really important feature to me,
since it would enable me to not have to reload nginx periodically with a
new config file!

Regards,
Samy
Samuel Vogel (Guest)
on 2008-10-20 20:25
(Received via mailing list)
Maybe it would be helpful if I included my config file:
server {
        listen 127.0.0.1:81;
        server_name  localhost;

        set $userid "default";

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

        root   /www/$userid;
        index  index.html index.htm;

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

Samuel Vogel schrieb:
Igor S. (Guest)
on 2008-10-20 23:17
(Received via mailing list)
On Mon, Oct 20, 2008 at 02:16:18PM +0200, Samuel Vogel wrote:

>
> Is this not supported? It would be a really important feature to me,
> since it would enable me to not have to reload nginx periodically with a
> new config file!

No, variables are not supoorted in fastcgi_pass currently.
I will probably add them in the near future.
Samuel Vogel (Guest)
on 2008-10-21 02:01
(Received via mailing list)
Igor S. schrieb:
> No, variables are not supoorted in fastcgi_pass currently.
> I will probably add them in the near future.
>
This would be a really important feature to us. I would guess that it
wouldn't be too hard to implement, since other directives already
support variables.
Is there any way to get you to implement this for the next release of
nginx?

Regards,
Samy
Samuel Vogel (Guest)
on 2008-11-17 01:36
(Received via mailing list)
Igor S. schrieb:
> No, variables are not supoorted in fastcgi_pass currently.
> I will probably add them in the near future.
>
Is there any timeframe when you will get to add this feature?
It would be really helpful for my in the environment I have to set up
currently!

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