Kategorien
Frameworks Kohana Linux Nginx Server Shell

Kohana 2.3 NGINX htaccess like URL rewrite

Um Kohana 2.3 auf NGINX mit sauberen URLs zu konfigurieren geht folgende NGINX server config:

server {
        server_name example.com www.example.com;
        listen   80;

        root /srv/www/example.com/pages/;
        access_log /srv/www/example.com/logs/access.log;
        error_log /srv/www/example.com/logs/error.log;

        index index.php index.html index.htm;

        try_files $uri $uri/ @rewrite;

        location @rewrite {
                rewrite ^/(.*)$ /index.php/$1;
        }

        location ~ \.php {
                fastcgi_index index.php;
                fastcgi_pass 127.0.0.1:9000;

                include fastcgi_params;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param ENV "production";
        }
}