0% found this document useful (0 votes)
16 views

Drupal - Nginx - .Conf

This Nginx configuration file summary provides routing for a Drupal 6 site. It defines the server name and document root, denies access to backup files, routes static files directly and PHP files to the FastCGI application, sets caching for images and assets, and rewrites URLs to the index.php front controller.

Uploaded by

fndtn357
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Drupal - Nginx - .Conf

This Nginx configuration file summary provides routing for a Drupal 6 site. It defines the server name and document root, denies access to backup files, routes static files directly and PHP files to the FastCGI application, sets caching for images and assets, and rewrites URLs to the index.php front controller.

Uploaded by

fndtn357
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

server { server_name domain.tld; root /var/www/drupal6; ## <-- Your only path reference. location = /favicon.

ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } # This matters if you use drush location = /backup { deny all; } # Very rarely should these ever be accessed outside of your lan location ~* \.(txt|log)$ { allow 192.168.0.0/16; deny all; } location ~ \..*/.*\.php$ { return 403; } location / { # This is cool because no php is touched for static content try_files $uri @rewrite; } location @rewrite { # Some modules enforce no slash (/) at the end of the URL # Else this rewrite block wouldn't be needed (GlobalRedirect) rewrite ^/(.*)$ /index.php?q=$1; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; fastcgi_pass unix:/tmp/phpfpm.sock; } # Fighting with ImageCache? This little gem is amazing. location ~ ^/sites/.*/files/imagecache/ { try_files $uri @rewrite; }

# Catch image styles for D7 too. location ~ ^/sites/.*/files/styles/ { try_files $uri @rewrite; } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } }

You might also like