Mastering Nginx

(Ron) #1
Chapter 6

[ 153 ]

## (Drupal 6: use only one)
try_files $uri /index.php?q=$uri;

}

# XML Sitemap support.
location = /sitemap.xml {
try_files $uri @drupal-no-args;

## (Drupal 6: use only one)
try_files $uri /index.php?q=$uri;
}

# Support for favicon. Return an 1x1 transparent GIF if it doesn't
# exist.
location = /favicon.ico {

expires 30d;

try_files /favicon.ico @empty;

}

# Return an in-memory 1x1 transparent GIF.
location @empty {

expires 30d;

empty_gif;

}

# Any other attempt to access PHP files returns a 404.
location ~* ^.+\.php$ {

return 404;

}

} # server context ends here

The include files mentioned above are not reproduced here, for brevity's sake.
They can be found in perusio's GitHub repository mentioned at the beginning


of this section.

Free download pdf