server { listen 80; server_name {server_name}; root /var/www/vhosts/gallery; location / { index index.php index.html index.htm; if (!-e $request_filename) { rewrite ^/(.+)$ /index.php?kohana_uri=$1 last; } } location /var/ { try_files $uri /index.php?kohana_uri=$2; } location ~ ^/(var/tmp|var/logs|var/uploads|bin)/ { deny all; } location ~ \.php$ { fastcgi_pass phpfpm; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_read_timeout 90; include fastcgi_params; } }