Created
January 11, 2012 09:10
-
-
Save inadarei/1593835 to your computer and use it in GitHub Desktop.
Nginx Config for Drupal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name debian.vm; | |
root /var/www/debian.vm/drupal; | |
access_log /var/www/debian.vm/logs/access.log; | |
error_log /var/www/debian.vm/logs/error.log; | |
index index.html index.htm index.php; | |
# DRUPAL STUFF | |
client_max_body_size 16M; | |
location / { | |
error_page 404 index.php; | |
error_page 403 /403.html; | |
# the main drupal app | |
if (!-e $request_filename) { | |
rewrite ^/(.*)$ /index.php?q=$1 last; | |
} | |
} | |
# serve static files directly | |
location ~* ^.+\.(wsf|xml|pdf|doc|jpg|jpeg|gif|css|png|js|ico)$ { | |
#rewrite ^/favicon.ico$ /sites/drupal-6.x/themes/mytheme/favicon.ico break; | |
access_log off; | |
expires 30d; | |
} | |
# imagecache needs to have php read any files that it's planning to manipulate | |
location ^~ /sites/all/files/imagecache/ { | |
index index.php index.html; | |
# assume a clean URL is requested, and rewrite to index.php | |
if (!-e $request_filename) { | |
rewrite ^/(.*)$ /index.php?q=$1 last; | |
break; | |
} | |
} | |
# deny access to .htaccess files, if Apache's document root | |
# concurs with nginx's one | |
# | |
location ~ /\.ht { | |
deny all; | |
} | |
# END DRUPAL STUFF | |
# php file handling | |
location ~ \.php$ { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param SERVER_NAME $http_host; | |
fastcgi_ignore_client_abort on; | |
} | |
gzip on; | |
gzip_comp_level 2; | |
gzip_proxied any; | |
gzip_min_length 1000; | |
gzip_disable "MSIE [1-6]\." | |
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment