Skip to content

Instantly share code, notes, and snippets.

@jakzal
Created April 13, 2011 18:07
Show Gist options
  • Save jakzal/918043 to your computer and use it in GitHub Desktop.
Save jakzal/918043 to your computer and use it in GitHub Desktop.
Nginx Configuration for PHP
server {
server_name kuba.dev;
root /var/www/$host/current/web;
access_log /var/log/nginx/$host-access.log;
error_log /var/log/nginx/kuba.dev-error.log error;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php/$1;
}
location ~ \.php {
# try_files $uri =404;
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;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment