server { listen *:80; server_name domain.tld *.domain.tld; access_log /path/to/log/access.log; error_log /path/to/log/error.log debug; client_max_body_size 6M; root /path/to/webroot; index index.php; 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 ~* ^.+\.(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; } } # serve the app via fastcgi location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_read_timeout 240; include /etc/nginx/fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; } }