Skip to content

Instantly share code, notes, and snippets.

@alterakey
Created December 3, 2014 16:19
Show Gist options
  • Save alterakey/2c657e8d635ef3b27924 to your computer and use it in GitHub Desktop.
Save alterakey/2c657e8d635ef3b27924 to your computer and use it in GitHub Desktop.
nginx configuration for CakePHP 2.0.3
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;
server {
listen 80;
server_name cakephp.test;
root /var/www/cakephp/app/webroot;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
index index.php;
try_files $uri $uri/ @cakephp;
}
location @cakephp {
rewrite ^(.+)$ /index.php last;
}
location ~ \.php$ {
include fastcgi_params_cakephp;
fastcgi_pass php;
}
location ~ \.php/ {
include fastcgi_params_cakephp;
fastcgi_pass php;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
log_not_found off;
access_log off;
}
location ~ /(\.ht|\.user.ini|\.git|\.hg|\.bzr|\.svn) {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment