Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
107 lines (92 sloc) 2.86 KB
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# This matters if you use drush prior to 5.x
# After 5.x backups are stored outside the Drupal install.
#location = /backup {
# deny all;
#}
# Very rarely should these ever be accessed outside of your lan
location ~* \.(txt|log)$ {
allow 192.168.0.0/16;
deny all;
}
# Allow web fonts from remote locations,
# otherwise Firefox and IE blocks it
location ~* "^.*?\.(eot)|(ttf)|(woff)$" {
add_header Access-Control-Allow-Origin *;
}
location ~ \..*/.*\.php$ {
return 403;
}
# No no for private
location ~ ^/sites/.*/private/ {
return 403;
}
# Block access to "hidden" files and directories whose names begin with a
# period. This includes directories used by version control systems such
# as Subversion or Git to store control files.
location ~ (^|/)\. {
return 403;
}
location / {
# This is cool because no php is touched for static content
try_files $uri @cache;
}
# This will try to see if we have a boost file in place. no harm done if this is not used
location @cache {
# queries, drupal cookies, or not GET methods, all require PHP processing.
if ($query_string ~ ".+") {
return 405;
}
if ($http_cookie ~ "DRUPAL_UID" ) {
return 405;
}
if ($request_method !~ ^(GET|HEAD)$ ) {
return 405;
}
error_page 405 = @drupal;
# Drupal uses 1978 - I am 4 years older than Dries :)
add_header Expires "Thu, 30 Jun 1983 08:00:00 GMT";
add_header Cache-Control "must-revalidate, post-check=0, pre-check=0";
# Boost doesn't set a charset
charset utf-8;
try_files /cache/normal/$host${uri}_${args}.html /cache/perm/$host${uri}_.css /cache/perm/$host${uri}_.js /cache/$host/0$uri.html /cache/$host/0${uri}/index.html @drupal;
}
# This rewrites pages to be sent to PHP processing
location @drupal {
index index.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#fastcgi_read_timeout 600; # Default 60 is usually enough, usually set it to the same as php.ini max_execution_time (default 30), set it higher if using xdebug
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_intercept_errors on;
# NOTE: If your php-fpm configuration is using a port instead of a socket use next fastcgi_pass config instead
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
# Fighting with Styles? This little gem is amazing.
# This is for D6
location ~ ^/sites/.*/files/imagecache/ {
try_files $uri @drupal;
}
# This is for D7 and D8
location ~ ^/sites/.*/files/styles/ {
try_files $uri @drupal;
}
location ~* \.(js|css|html|swf|flv|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}