nginx: change regex patterns to non-capturing for speedup

This commit is contained in:
Aitte 2013-02-24 15:40:13 -05:00 committed by Andy Dawson
parent b39dfb59fd
commit a8679c18b7
4 changed files with 6 additions and 6 deletions

View File

@ -5,6 +5,6 @@
# Read also this: github.com/h5bp/html5-boilerplate/wiki/cachebusting
# This is not included by default, because it'd be better if you use the build
# script to manage the file names.
location ~* (.+)\.(\d+)\.(js|css|png|jpg|jpeg|gif)$ {
try_files $uri $1.$3;
location ~* (.+)\.(?:\d+)\.(js|css|png|jpg|jpeg|gif)$ {
try_files $uri $1.$2;
}

View File

@ -1,5 +1,5 @@
# Cross domain webfont access
location ~* \.(ttf|ttc|otf|eot|woff|font.css)$ {
location ~* \.(?:ttf|ttc|otf|eot|woff|font.css)$ {
add_header "Access-Control-Allow-Origin" "*";
# Also, set cache rules for webfonts.

View File

@ -36,7 +36,7 @@ location ~* \.(?:css|js)$ {
# WebFonts
# If you are NOT using cross-domain-fonts.conf, uncomment the following directive
# location ~* \.(ttf|ttc|otf|eot|woff|font.css)$ {
# location ~* \.(?:ttf|ttc|otf|eot|woff|font.css)$ {
# expires 1M;
# access_log off;
# add_header Cache-Control "public";

View File

@ -1,9 +1,9 @@
# Prevent clients from accessing hidden files (starting with a dot)
location ~* (^|/)\. {
location ~* (?:^|/)\. {
return 403;
}
# Prevent clients from accessing to backup/config/source files
location ~* (\.(bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$ {
location ~* (?:\.(?:bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$ {
return 403;
}