Skip to content

Instantly share code, notes, and snippets.

@dmouse
Last active December 16, 2015 18:39
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 dmouse/5479498 to your computer and use it in GitHub Desktop.
Save dmouse/5479498 to your computer and use it in GitHub Desktop.
Nginx + PHP-FPM + Drupal, sample configuration file for nginx and Drupal
server {
listen 80;
server_name site.com www.site.com ;
server_tokens off;
aio off;
directio off;
sendfile on;
gzip on;
proxy_read_timeout 900s;
fastcgi_read_timeout 900s;
client_max_body_size 10M;
access_log /var/log/nginx/site.com_access.log;
error_log /var/log/nginx/site.com_error.log;
location ~ /\.git {
deny all;
}
location ~ \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$ {
return 403;
}
location ~ ^/private/ {
return 403;
}
location ~ ^/sites/default/files/private/ {
return 403;
}
location ~ ^/sites/default/config/ {
return 403;
}
location ~ /sites/default/files/.*\.php$ {
return 403;
}
location / {
root /var/www/vhosts/site.com/httpdocs;
index index.php;
try_files $uri $uri/ @rewrite;
expires max;
}
location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}
location ~ \.php$ {
root /var/www/vhosts/site.com/httpdocs;
#try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_read_timeout 120;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment