Welcome! Log In Create A New Profile

Advanced

Замена if на try_files

December 13, 2011 01:26PM
Приветствую

Пытаюсь заменить

if (!-e $request_filename) {
rewrite '(?i)^' /$subfolder/index.php last;
}

на

location / {
try_files $uri /$subfolder/index.php;
}

в

server {
server_name server.com;
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log debug;

if ($request_uri ~ ^/([^/]*).*$) {
set $subfolder $1;
}

root /home/www/server.com/htdocs;
index index.html index.php;

error_page 404 /$subfolder/index.php?page=404;

location / {
try_files $uri /$subfolder/index.php;
}

location ^~ /$subfolder/errors/ {
...
}

location ~* \.(css|gif|html|ico|jpg|js|pdf|png)$ {
...
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SERVER_NAME $host;
}
}


С if - все ОК.

Если использую try_files - не видно GET в PHP из запроса вида
http://server.com/project/?some_variable=1

Что не так? Видимо запрос попадает не в тот локейшн?

_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

Замена if на try_files

sergey.kobzar December 13, 2011 01:26PM

Re: Замена if на try_files

sergey.kobzar December 13, 2011 04:02PM

Re: Замена if на try_files

Maxim Dounin December 13, 2011 06:54PM

Re: Замена if на try_files

sergey.kobzar December 14, 2011 08:38AM

Re: Замена if на try_files

Maxim Dounin December 14, 2011 09:12AM

Re: Замена if на try_files

Maxim Dounin December 14, 2011 09:40AM

Re: Замена if на try_files

sergey.kobzar December 14, 2011 10:10AM

Re: Замена if на try_files

Maxim Dounin December 14, 2011 11:34AM

Re: Замена if на try_files

sergey.kobzar December 14, 2011 11:46AM

Re: Замена if на try_files

Oleksandr V. Typlyns'kyi December 14, 2011 02:12PM

Re: Замена if на try_files

sergey.kobzar December 14, 2011 02:24PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 56
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready