Skip to content

Instantly share code, notes, and snippets.

@zeroasterisk
Created August 1, 2011 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeroasterisk/1118945 to your computer and use it in GitHub Desktop.
Save zeroasterisk/1118945 to your computer and use it in GitHub Desktop.
app - /etc/nginx/standard_location_config_cakephp
#
# These are standard location configs which should be setup in all CakePHP apps
# basic php functionality
# basic document resolution configuration
# basic security
# basic optimization
#
#PHP Magic
location ~ \.php(.*)$ {
fastcgi_pass unix:/var/run/php5-fpm.socket;
}
location ~ \..*/.*\.php(.*)$ {
return 403;
}
#Site Locations
location / {
rewrite ^/$ /index.php?url=/ last;
if (-f $request_filename) {
break;
}
try_files $uri $uri/ /index.php?url=$request_uri;
if (!-f $request_filename) {
rewrite ^/(.*)$ /index.php?url=$1 last;
}
}
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html|swf|flv|mp3|m4v)$ {
access_log off;
expires 30d;
try_files $uri $uri/ /index.php?url=$request_uri;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment