Skip to content

Instantly share code, notes, and snippets.

@sanguis
Created September 14, 2012 14:15
Show Gist options
  • Save sanguis/3722160 to your computer and use it in GitHub Desktop.
Save sanguis/3722160 to your computer and use it in GitHub Desktop.
drupal nginx config file for ubuntu 12.04 server
server {
server_name DOMAIN;
root /var/www/PATH;
index index.html index.htm index.php;
location = /favicon.ico {
log_not_found off;
access_log off;
}
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
error_page 404 index.php;
# hide protected files
location ~* .(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(.php)?|xtmpl)$|^(code-style.pl|Entries.*|Repository|Root|Tag|Template)$ {
deny all;
}
# hide backup_migrate files
location ~* ^/files/backup_migrate {
deny all;
}
# serve static files directly
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
access_log off;
expires 30d;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
include /etc/nginx/fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment