I already shared some nginx configuration for php, but here is one for drupal.
server ~ / $ cat /etc/nginx/sites-available/drupal.conf server { listen 80; server_name DOMAIN; error_log logs/DOMAIN-error.log; access_log logs/comDOMAIN-access.log main; server_name_in_redirect off; root /var/www/DOMAIN; index index.php; location = / { root /var/www/DOMAIN; index index.php; } location / { root /var/www/DOMAIN; index index.php; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?q=$1 last; break; } } error_page 404 /index.php; $ redirect server error pages to the static page /50x.html $ error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { fastcgi_pass 127.0.0.1:8888; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/DOMAIN$fastcgi_script_name; } $ deny access to .htaccess files, if Apache's document root $ concurs with nginx's one $ location ~ /\.ht { deny all; } } |