2019-12-03 19:48:18 +01:00
|
|
|
# Redis NGINX CONFIGURATION - WordOps {{release}}
|
2018-11-13 21:55:59 +01:00
|
|
|
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
|
2019-03-06 15:32:07 +01:00
|
|
|
# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf
|
|
|
|
|
|
2018-11-13 21:55:59 +01:00
|
|
|
# Use cached or actual file if they exists, Otherwise pass request to WordPress
|
|
|
|
|
location / {
|
2019-02-25 07:47:36 +01:00
|
|
|
try_files $uri $uri/ /index.php$is_args$args;
|
2018-11-13 21:55:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
location /redis-fetch {
|
|
|
|
|
internal ;
|
|
|
|
|
set $redis_key $args;
|
2019-08-06 11:37:03 +02:00
|
|
|
redis_pass redis;
|
2018-11-13 21:55:59 +01:00
|
|
|
}
|
|
|
|
|
location /redis-store {
|
|
|
|
|
internal ;
|
|
|
|
|
set_unescape_uri $key $arg_key ;
|
|
|
|
|
redis2_query set $key $echo_request_body;
|
|
|
|
|
redis2_query expire $key 14400;
|
2019-08-08 08:40:03 +02:00
|
|
|
redis2_pass redis;
|
2018-11-13 21:55:59 +01:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
location ~ \.php$ {
|
|
|
|
|
set $key "nginx-cache:$scheme$request_method$host$request_uri";
|
|
|
|
|
try_files $uri =404;
|
|
|
|
|
|
|
|
|
|
srcache_fetch_skip $skip_cache;
|
|
|
|
|
srcache_store_skip $skip_cache;
|
|
|
|
|
|
|
|
|
|
srcache_response_cache_control off;
|
|
|
|
|
|
|
|
|
|
set_escape_uri $escaped_key $key;
|
|
|
|
|
|
|
|
|
|
srcache_fetch GET /redis-fetch $key;
|
|
|
|
|
srcache_store PUT /redis-store key=$escaped_key;
|
|
|
|
|
|
|
|
|
|
more_set_headers 'X-SRCache-Fetch-Status $srcache_fetch_status';
|
|
|
|
|
more_set_headers 'X-SRCache-Store-Status $srcache_store_status';
|
|
|
|
|
|
|
|
|
|
include fastcgi_params;
|
2019-08-05 19:17:59 +02:00
|
|
|
fastcgi_pass {{upstream}};
|
2018-11-13 21:55:59 +01:00
|
|
|
}
|