-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version 3.1 - multiple small fixes and tiny improvements
- Loading branch information
Showing
9 changed files
with
127 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# To improve the perf, we may use open_file_cache | ||
# ref: https://nginx.org/r/open_file_cache | ||
# open_file_cache max=1000; | ||
# open_file_cache_valid 60s; | ||
# open_file_cache_min_uses 2; | ||
# open_file_cache_errors off; | ||
|
||
location / { | ||
# requires server support | ||
# gzip_static on; | ||
|
||
error_page 418 = @cachemiss; | ||
error_page 419 = @mobileaccess; | ||
recursive_error_pages on; | ||
|
||
# bypass POST requests | ||
if ($request_method = POST) { return 418; } | ||
|
||
# uncommenting the following degrades the performance on certain sites. YMMV | ||
# if ($query_string != "") { return 418; } | ||
|
||
# bypass cache for common query strings | ||
if ($arg_s != "") { return 418; } # search query | ||
if ($arg_p != "") { return 418; } # request a post / page by ID | ||
if ($arg_amp != "") { return 418; } # amp test | ||
if ($arg_preview = "true") { return 418; } # preview post / page | ||
if ($arg_ao_noptimize != "") { return 418; } # support for Autoptimize plugin | ||
|
||
if ($http_cookie ~* "wordpress_logged_in_") { return 418; } | ||
if ($http_cookie ~* "comment_author_") { return 418; } | ||
if ($http_cookie ~* "wp_postpass_") { return 418; } | ||
|
||
# if ($http_user_agent ~* "2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800|iPad") { return 419; } | ||
|
||
# uncomment the following if deemed fit | ||
# if ($http_user_agent ~* "w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-|ipad") { return 419; } | ||
|
||
try_files "/wp-content/cache/cache-enabler/$host${uri}index.html" $uri $uri/ /index.php$is_args$args; | ||
|
||
#--> all the following would apply, only if the request hits the cache | ||
|
||
add_header "X-Cache" "HIT - Cache Enabler"; | ||
# include "globals/hsts.conf"; | ||
|
||
# expires modified 30m; | ||
expires 30m; | ||
add_header "Cache-Control" "must-revalidate"; | ||
|
||
# For proxies | ||
# add_header "Cache-Control" "s-maxage=3600"; | ||
} | ||
|
||
location @mobileaccess { | ||
# try_files $uri $uri/ /index.php$is_args$args; | ||
try_files "/wp-content/cache/supercache/$host${uri}index$https_suffix-mobile.html" $uri $uri/ /index.php$is_args$args; | ||
|
||
add_header "X-Cache" "HIT - Mobile - Cache Enabler"; | ||
# include "globals/hsts.conf"; | ||
|
||
# expires modified 30m; | ||
expires 30m; | ||
add_header "Cache-Control" "must-revalidate"; | ||
|
||
# For proxies | ||
# add_header "Cache-Control" "s-maxage=3600"; | ||
} | ||
|
||
location @cachemiss { | ||
try_files $uri $uri/ /index.php$is_args$args; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# make sure you set up a cron to run update-cloudflare-ip-list.sh regularly | ||
|
||
include '/etc/nginx/globals/cloudflare-ip-list.conf'; | ||
|
||
# use any of the following two options (but not both) | ||
real_ip_header CF-Connecting-IP; | ||
# real_ip_header X-Forwarded-For; | ||
|
||
real_ip_recursive on; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters