Skip to content

Instantly share code, notes, and snippets.

@tibezh
Created November 26, 2015 08:53
Show Gist options
  • Save tibezh/1ccdc521c08a78ca9379 to your computer and use it in GitHub Desktop.
Save tibezh/1ccdc521c08a78ca9379 to your computer and use it in GitHub Desktop.
Nginx drupal settings
server {
listen 80;
server_name localhost;
root /var/www;
index index.php index.html;
client_max_body_size 200M;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
alias /usr/share/nginx/www/robots.txt;
log_not_found off;
access_log off;
}
# Make sure files with the following extensions do not get loaded by nginx because nginx would display the source code, and these files can contain PASSWORDS!
location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ {
deny all;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location / {
try_files $uri @rewrite;
#deny all;
}
location @rewrite {
rewrite ^/(\w*)/(.*)$ /$1/index.php?q=$2 last;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_read_timeout 300;
fastcgi_buffers 4 32M;
fastcgi_busy_buffers_size 64M;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment