4 messages in ru.sysoev.nginxRe: try_files in subdirectory
FromSent OnAttachments
Mathew DaviesMay 17, 2009 3:05 pm 
Michael ShadleMay 17, 2009 3:39 pm 
Mathew DaviesMay 19, 2009 3:32 pm 
Igor SysoevMay 20, 2009 2:15 am 
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: try_files in subdirectoryActions...
From:Igor Sysoev (is@rambler-co.ru)
Date:May 20, 2009 2:15:25 am
List:ru.sysoev.nginx

On Sun, May 17, 2009 at 11:05:23PM +0100, Mathew Davies wrote:

Hi, I am using try_files in a subdirectory and I'm coming up with some issues.

# default

server

{

server_name localhost;

location ~ \.php$

{

try_files $uri $uri/;

Here "$uri/" is fallback parameter. However, this is not cause of the problem.

fastcgi_pass 127.0.0.1:9000;

include fastcgi_params;

}

location /devkit/

{

try_files $uri $uri/ @kohana;

}

location @kohana

{

fastcgi_pass 127.0.0.1:9000;

include fastcgi_params;

fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/devkit/index.php;

}

}

This URL works correctly,

http://www.domain.com/devkit/index.php/coaster/17/olympia-looping

but when I remove the index.php file I get :

The page you requested devkit/coaster/17/olympia-looping could not be found.

but it should be coaster/17/olympia-looping instead.

You need something like this:

location /devkit { try_files $uri $uri/ @kohana; }

location @kohana { fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(/devkit)(/.*)$; fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/devkit/index.php; fastcgi_param PATH_INFO $fastcgi_path_info; }