server
{
listen 80;
server_name localhost;
root /var/www/localhost;
index index.php;
location /
{
try_files $uri $uri/ @kohana;
}
# Handles non kohana requests.
location ~* \\\.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
location @kohana
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
include fastcgi_params;
}
}
for kohana_3.0 api_changes
location / {
index index.php index.html;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
}
include /var/www/domain.com/htaccess;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:8888;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/domain.com/public$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
# kohana
set $path_info "";
location /index.php {
if ($uri ~ "^/index.php(/.+)$") {
set $path_info $1;
}
fastcgi_pass 127.0.0.1:8888;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/domain.com/public/index.php;
fastcgi_param PATH_INFO $path_info;
include /etc/nginx/fastcgi_params;
}
location / {
if (-f $request_filename) {
expires max;
break;
}
if (!-e $request_filename) {
rewrite ^/(.+)$ /index.php?kohana_uri=$1 last; # NOTICE THIS LINE CHANGE
break;
}
}
It is also on the guide near the end.
Posted By: axelTook me a massive long time to configure Nginx for Kohana. None of the examples above worked for me. So I wrote the VirtualHost from scratch:http://vidax.net/blog/en/2010/06/kohana-with-nginx-virtualhost-configuration/
Hope it helpsAxel
It looks like you're new here. If you want to get involved, click one of these buttons!