Commit 3bc99fd6 authored by omega8cc's avatar omega8cc

Use faster locations matching where possible in the Nginx config.

parent 48c1750f
......@@ -68,15 +68,17 @@ location = /cron.php {
### Send search to php-fpm early so searching for node.js will work.
### Deny bots on search uri without 403 response.
###
location ~* /search {
if ($is_bot) {
return 444;
location ^~ /search {
location ~* ^/search {
if ($is_bot) {
return 444;
}
try_files $uri @cache;
}
try_files $uri @cache;
}
###
### Don't log known AJAX requests.
### Deny crawlers and never cache known AJAX requests.
###
location ~* /autocomplete/ {
if ($is_bot) {
......@@ -105,7 +107,7 @@ location ^~ /progress {
###
### Fix for Aegir & .info .pl domain extensions.
###
location ~* /hosting {
location ^~ /hosting {
access_log off;
set $nocache_details "Skip";
try_files $uri @drupal;
......@@ -114,7 +116,7 @@ location ~* /hosting {
###
### Support for backup_migrate module download/restore/delete actions.
###
location ~* /admin {
location ^~ /admin {
if ($is_bot) {
return 444;
}
......@@ -126,13 +128,15 @@ location ~* /admin {
###
### Support for audio module.
###
location ~* ^/audio/download/.*/.*\.(?:mp3|mp4|m4a|ogg)$ {
if ($is_bot) {
return 444;
location ^~ /audio/download {
location ~* ^/audio/download/.*/.*\.(?:mp3|mp4|m4a|ogg)$ {
if ($is_bot) {
return 444;
}
access_log off;
set $nocache_details "Skip";
try_files $uri @drupal;
}
access_log off;
set $nocache_details "Skip";
try_files $uri @drupal;
}
###
......
......@@ -68,15 +68,17 @@ location = /cron.php {
### Send search to php-fpm early so searching for node.js will work.
### Deny bots on search uri without 403 response.
###
location ~* /search {
if ($is_bot) {
return 444;
location ^~ /search {
location ~* ^/search {
if ($is_bot) {
return 444;
}
try_files $uri @cache;
}
try_files $uri @cache;
}
###
### Don't log known AJAX requests.
### Deny crawlers and never cache known AJAX requests.
###
location ~* /autocomplete/ {
if ($is_bot) {
......@@ -91,7 +93,7 @@ location ~* /autocomplete/ {
###
### Fix for Aegir & .info .pl domain extensions.
###
location ~* /hosting {
location ^~ /hosting {
access_log off;
set $nocache_details "Skip";
try_files $uri @drupal;
......@@ -100,7 +102,7 @@ location ~* /hosting {
###
### Support for backup_migrate module download/restore/delete actions.
###
location ~* /admin {
location ^~ /admin {
if ($is_bot) {
return 444;
}
......@@ -112,13 +114,15 @@ location ~* /admin {
###
### Support for audio module.
###
location ~* ^/audio/download/.*/.*\.(?:mp3|mp4|m4a|ogg)$ {
if ($is_bot) {
return 444;
location ^~ /audio/download {
location ~* ^/audio/download/.*/.*\.(?:mp3|mp4|m4a|ogg)$ {
if ($is_bot) {
return 444;
}
access_log off;
set $nocache_details "Skip";
try_files $uri @drupal;
}
access_log off;
set $nocache_details "Skip";
try_files $uri @drupal;
}
###
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment