Welcome! Log In Create A New Profile

Advanced

Re: include в if-е

Aleksandr Sytar
December 07, 2011 06:44AM
7 декабря 2011 г. 15:24 пользователь Ilya Lobahin
<i.lobahin@nikitaonline.ru> написал:
> Здравствуйте, коллеги.
>
> Пытаюсь сделать так:
> location ~ \.php$ {
>    if ( $uri !~ "^/images/" ){
>        include /etc/nginx/fastcgi.conf;
>    }
> }
>
> Получаю:
> nginx: [emerg] "include" directive is not allowed here
> Почему? В описании директивы контекст любой.
>
> Приходится извращаться так:
> location ~ \.php$ {
>    if ( $uri !~ "^/images/" ){
>        fastcgi_pass   127.0.0.1:8181;  # By all means use a different server for the fcgi processes if you need to
>    }
>        include /etc/nginx/fastcgi2.conf;
> }

А почему не хотите так:

location /images {
...
location ~ \.php$ {
fastcgi_pass   127.0.0.1:8181;  # By all means use a different
server for the fcgi processes if you need to
}
}

location ~\.php$ {
include /etc/nginx/fastcgi2.conf;
}
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

include в if-е

Ilya Lobahin December 07, 2011 06:26AM

Re: include в if-е

Aleksandr Sytar December 07, 2011 06:44AM

Re[2]: include в if-е

Ilya Lobahin December 07, 2011 07:02AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 175
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready