Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #######################################################
- ### nginx.conf catch-all
- #######################################################
- client_max_body_size 75M;
- gzip_static on;
- gzip on;
- gzip_comp_level 9;
- gzip_types application/x-javascript text/css text/plain text/xml application/xml application/xml+rss text/javascript;
- location = /favicon.ico {
- log_not_found off;
- access_log off;
- }
- location = /robots.txt {
- allow all;
- log_not_found off;
- access_log off;
- }
- # This is mostly based on Drupal's stock .htaccess
- location ~* ^.+(\.(txt|engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ {
- return 404;
- }
- # serve static files directly
- location ~* ^.+\.(jpg|jpeg|gif|png|ico|swf|flv)$ {
- access_log off;
- expires 30d;
- }
- # 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;
- }
- ## Deny some crawlers
- if ($http_user_agent ~* (HTTrack|HTMLParser|libwww) ) {
- return 444;
- }
- ## Deny certain Referers (case insensitive)
- if ($http_referer ~* (poker|sex|girl) ) {
- return 444;
- }
- ## 6.x starts
- location / {
- rewrite ^/(.*)/$ /$1 permanent; # remove trailing slashes - disabled
- try_files $uri @cache;
- }
- location @cache {
- if ( $request_method !~ ^(GET|HEAD)$ ) {
- return 405;
- }
- if ($http_cookie ~ "DRUPAL_UID") {
- return 405;
- }
- error_page 405 = @drupal;
- add_header Expires "Tue, 24 Jan 1984 08:00:00 GMT";
- add_header Cache-Control "must-revalidate, post-check=0, pre-check=0";
- add_header X-Header "Boost Citrus 1.9";
- charset utf-8;
- try_files /cache/normal/$host${uri}_$args.html /cache/$host${uri}_$args.html @drupal;
- }
- location @drupal {
- rewrite ^/(.*)$ /index.php?q=$1 last;
- }
- location ~* (/\..*|settings\.php$|\.(htaccess|engine|inc|info|install|module|profile|pl|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(Entries.*|Repository|Root|Tag|Template))$ {
- deny all;
- }
- location ~* /files/.*\.php$ {
- return 444;
- }
- location ~* /themes/.*\.php$ {
- return 444;
- }
- location ~ \.css$ {
- if ( $request_method !~ ^(GET|HEAD)$ ) {
- return 405;
- }
- if ($http_cookie ~ "DRUPAL_UID") {
- return 405;
- }
- error_page 405 = @uncached;
- access_log off;
- expires max; #if using aggregator
- add_header X-Header "Boost Citrus 2.1";
- try_files /cache/perm/$host${uri}_.css /cache/$host${uri}_.css $uri =404;
- }
- location ~ \.js$ {
- if ( $request_method !~ ^(GET|HEAD)$ ) {
- return 405;
- }
- if ($http_cookie ~ "DRUPAL_UID") {
- return 405;
- }
- error_page 405 = @uncached;
- access_log off;
- expires max; # if using aggregator
- add_header X-Header "Boost Citrus 2.2";
- try_files /cache/perm/$host${uri}_.js /cache/$host${uri}_.js $uri =404;
- }
- location ~ \.json$ {
- if ( $request_method !~ ^(GET|HEAD)$ ) {
- return 405;
- }
- if ($http_cookie ~ "DRUPAL_UID") {
- return 405;
- }
- error_page 405 = @uncached;
- access_log off;
- expires max; # if using aggregator
- add_header X-Header "Boost Citrus 2.3";
- try_files /cache/normal/$host${uri}_.json /cache/$host${uri}_.json $uri =404;
- }
- location @uncached {
- access_log off;
- expires max; # max if using aggregator, otherwise sane expire time
- }
- location ^~ /sites/default/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;
- }
- }
- location ~* ^.+\.(jpg|jpeg|gif|png|ico)$ {
- access_log off;
- expires max;
- try_files $uri =404;
- }
- location ~* \.xml$ {
- if ( $request_method !~ ^(GET|HEAD)$ ) {
- return 405;
- }
- if ($http_cookie ~ "DRUPAL_UID") {
- return 405;
- }
- error_page 405 = @drupal;
- add_header Expires "Tue, 24 Jan 1984 08:00:00 GMT";
- add_header Cache-Control "must-revalidate, post-check=0, pre-check=0";
- add_header X-Header "Boost Citrus 2.4";
- charset utf-8;
- types { }
- default_type application/rss+xml;
- try_files /cache/normal/$host${uri}_.xml /cache/normal/$host${uri}_.html /cache/$host${uri}_.xml $uri @drupal;
- }
- location ~* /feed$ {
- if ( $request_method !~ ^(GET|HEAD)$ ) {
- return 405;
- }
- if ($http_cookie ~ "DRUPAL_UID") {
- return 405;
- }
- error_page 405 = @drupal;
- add_header Expires "Tue, 24 Jan 1984 08:00:00 GMT";
- add_header Cache-Control "must-revalidate, post-check=0, pre-check=0";
- add_header X-Header "Boost Citrus 2.5";
- charset utf-8;
- types { }
- default_type application/rss+xml;
- try_files /cache/normal/$host${uri}_.xml /cache/normal/$host${uri}_.html /cache/$host${uri}_.xml $uri @drupal;
- }
- #######################################################
- ### nginx.conf catch-all
- #######################################################
Add Comment
Please, Sign In to add comment