Skip to content

Instantly share code, notes, and snippets.

@soncco
Created December 27, 2012 21:33
Show Gist options
  • Save soncco/4392198 to your computer and use it in GitHub Desktop.
Save soncco/4392198 to your computer and use it in GitHub Desktop.
Drupal Nginx Configuration
server {
server_name www.example.com example.com;
access_log /srv/www/www.example.com/logs/access.log;
error_log /srv/www/www.example.com/logs/error.log;
root /srv/www/www.example.com/public_html;
rewrite ^/([^/])/(.)(/?)$ /$1/index.php?q=$2&$args;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location / {
index index.php index.html index.htm;
}
location @rewrite {
rewrite ^/([^/]*)/(.*)(/?)$ /$1/index.php?q=$2&$args;
}
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
location ~.(.htaccess|engine|inc|info|install|module|profile|po|sh|.sql|theme|tpl(.php)?|xtmpl)$ {
deny all;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/www.example.com/public_html$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment