Update wpce & wprocket template

This commit is contained in:
VirtuBox
2019-08-19 18:15:07 +02:00
parent 3c96f7709e
commit 1601cbb574
4 changed files with 43 additions and 61 deletions

View File

@@ -54,6 +54,12 @@ map $request_uri $uri_no_cache {
"~*/resetpass/" 1;
}
map $http_user_agent $mobile_prefix {
default "";
"~*iphone" -mobile;
"~*android" -mobile;
}
# do not cache requests with query strings
map $is_args $query_no_cache {
default 1;

View File

@@ -10,10 +10,10 @@ location ~ \.php$ {
include fastcgi_params;
fastcgi_pass {{upstream}};
}
location ~* /cache/cache-enabler/\.html$ {
location ~ /wp-content/cache/cache-enabler/.*html$ {
etag on;
add_header Vary "Accept-Encoding, Cookie";
access_log off;
log_not_found off;
expires 10h;
}
}

View File

@@ -3,14 +3,14 @@
# $cache_uri variable set in /etc/nginx/conf.d/map-wp.conf
# Use cached or actual file if they exists, Otherwise pass request to WordPress
location / {
try_files /wp-content/cache/wp-rocket/$http_host/$cache_uri/index$https_prefix.html $uri $uri/ /index.php$is_args$args;
try_files /wp-content/cache/wp-rocket/$http_host/$cache_uri/index${mobile_prefix}${https_prefix}.html /wp-content/cache/wp-rocket/$http_host/$cache_uri/index${https_prefix}.html $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass {{upstream}};
fastcgi_pass {{upstream}};
}
location ~* /cache/wp-rocket/\.html$ {
location ~ /wp-content/cache/wp-rocket/.*html$ {
etag on;
add_header Vary "Accept-Encoding, Cookie";
access_log off;