Mastering Nginx

(Ron) #1

The NGINX HTTP Server


[ 152 ]

include fastcgi_private_files.conf;

fastcgi_pass 127.0.0.1:9000;

}

## (Drupal 6)
## Restrict access to the strictly necessary PHP files. Reducing
# the
## scope for exploits. Handling of PHP code and the Drupal event
# loop.
## (use only one)
location = /index.php {

# This is marked internal as a pro-active security practice.
# No direct access to index.php is allowed; all accesses are
# made
# by NGINX from other locations or internal redirects.
internal;

fastcgi_pass 127.0.0.1:9000;

}

The following locations all have return 404 in order to deny access:


# Disallow access to .git directory: return 404 as not to disclose
# information.
location ^~ /.git { return 404; }
# Disallow access to patches directory.
location ^~ /patches { return 404; }
# Disallow access to drush backup directory.
location ^~ /backup { return 404; }
# Disable access logs for robots.txt.
location = /robots.txt {

access_log off;

}

# RSS feed support.
location = /rss.xml {

try_files $uri @drupal-no-args;
Free download pdf