15 messages in ru.sysoev.nginxRe: nginx-0.7.31
FromSent OnAttachments
Igor SysoevJan 19, 2009 6:05 am 
Kevin WorthingtonJan 19, 2009 7:10 am 
cynixJan 19, 2009 8:47 am 
Igor SysoevJan 19, 2009 9:44 am 
cynixJan 19, 2009 6:32 pm 
Igor SysoevJan 19, 2009 11:45 pm 
mikeJan 20, 2009 1:09 am 
Igor SysoevJan 20, 2009 1:17 am 
mikeJan 20, 2009 1:40 am 
Igor SysoevJan 20, 2009 2:14 am 
Igor SysoevJan 20, 2009 3:14 am 
Juan Fco. GiordanaJan 20, 2009 4:22 am 
Igor SysoevJan 20, 2009 4:59 am 
cynixJan 20, 2009 5:47 am 
Igor SysoevJan 20, 2009 6:37 am.dir
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: nginx-0.7.31Actions...
From:Igor Sysoev (is@rambler-co.ru)
Date:Jan 19, 2009 9:44:25 am
List:ru.sysoev.nginx

On Mon, Jan 19, 2009 at 04:47:33PM +0000, cynix wrote:

Igor Sysoev <is@...> writes:

Changes with nginx 0.7.31 19 Jan 2009

*) Change: now the "try_files" directive tests files only and ignores directories.

This seems to cause problems with index.php inside directories. For example:

index index.php; location / { try_files $uri @php; } location @php { fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME $document_root/index.php; } location ~ \.php$ { fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME $document_root$uri; }

With 0.7.30 if you request http://example.com/test/ , $document_root/test/index.php is served. However with 0.7.31, $document_root/index.php is served.

And if you do this:

try_files $uri $uri/index.php @php;

then nginx will serve index.php as a static file, without passing it to FastCGI. I know this is the intended behavior, as internal rewrite is only issued for the last parameter of try_files. So how should we let try_files detect index.php inside a directory if directories are ignored?

The change has been apperaed due to Mongrel-type configuration:

location / { try_files /system/maintenance.html $uri $uri/index.html $uri.html @mongrel; }

location @mogrel { proxy_pass http://mongrel; }

when "/" exists, but /index.html is not exist, then request was handled locally and return 403.

I will look how to resolve the issue.

One possible solution:

location / { try_files $uri @php; }

location @php { fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME $document_root/index.php; }

location ~ (/|\.php)$ { fastcgi_pass ...; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }