You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123 lines
3.1 KiB
123 lines
3.1 KiB
fastcgi_cache_key "$scheme$request_method$host$request_uri";
|
|
fastcgi_cache_use_stale error timeout invalid_header updating http_500 http_503;
|
|
fastcgi_cache_lock on;
|
|
fastcgi_cache_lock_age 5s;
|
|
fastcgi_cache_lock_timeout 5s;
|
|
fastcgi_cache_methods GET HEAD;
|
|
fastcgi_cache_background_update on;
|
|
fastcgi_cache_valid 200 24h;
|
|
fastcgi_cache_valid 301 302 30m;
|
|
fastcgi_cache_valid 499 502 503 1m;
|
|
fastcgi_cache_valid 404 1h;
|
|
fastcgi_cache_valid any 1h;
|
|
fastcgi_buffers 16 16k;
|
|
fastcgi_buffer_size 32k;
|
|
fastcgi_param SERVER_NAME $http_host;
|
|
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
|
|
fastcgi_keep_conn on;
|
|
|
|
# do not cache xhtml request
|
|
map $http_x_requested_with $http_request_no_cache {
|
|
default 0;
|
|
XMLHttpRequest 1;
|
|
}
|
|
|
|
# do not cache requests on cookies
|
|
map $http_cookie $cookie_no_cache {
|
|
default 0;
|
|
"~*wordpress_[a-f0-9]+" 1;
|
|
"~*wp-postpass" 1;
|
|
"~*wordpress_logged_in" 1;
|
|
"~*wordpress_no_cache" 1;
|
|
"~*comment_author" 1;
|
|
"~*woocommerce_items_in_cart" 1;
|
|
"~*edd_items_in_cart" 1;
|
|
"~*woocommerce_cart_hash" 1;
|
|
"~*wptouch_switch_toogle" 1;
|
|
"~*comment_author_email_" 1;
|
|
"~*wptouch_switch_toggle" 1;
|
|
"~*edd" 1;
|
|
}
|
|
|
|
# do not cache the following uri
|
|
map $request_uri $uri_no_cache {
|
|
default 0;
|
|
"~*/wp-admin/" 1;
|
|
"~*/wp-[a-zA-Z0-9-]+.php" 1;
|
|
"~*/feed/" 1;
|
|
"~*/index.php" 1;
|
|
"~*/[a-z0-9_-]+-sitemap([0-9]+)?.xml" 1;
|
|
"~*/sitemap(_index)?.xml" 1;
|
|
"~*/wp-comments-popup.php" 1;
|
|
"~*/wp-links-opml.php" 1;
|
|
"~*/xmlrpc.php" 1;
|
|
"~*/edd-sl/*" 1;
|
|
"~*/add_to_cart/" 1;
|
|
"~*/cart/" 1;
|
|
"~*/account/" 1;
|
|
"~*/my-account/" 1;
|
|
"~*/checkout/" 1;
|
|
"~*/addons/" 1;
|
|
"~*/wc-api/*" 1;
|
|
"~*/logout/" 1;
|
|
"~*/lost-password/" 1;
|
|
"~*/panier/" 1;
|
|
"~*/mon-compte/" 1;
|
|
"~*/embed" 1;
|
|
"~*/commande/" 1;
|
|
"~*/resetpass/" 1;
|
|
}
|
|
|
|
# do not cache requests with query strings
|
|
map $is_args $query_no_cache {
|
|
default 1;
|
|
"" 0;
|
|
}
|
|
|
|
# if all previous check are passed, $skip_cache = 0
|
|
map $http_request_no_cache$cookie_no_cache$uri_no_cache$query_no_cache $skip_cache {
|
|
default 1;
|
|
0000 0;
|
|
}
|
|
|
|
map $http_accept $webp_suffix_valid {
|
|
default 1;
|
|
"~*webp" 0;
|
|
}
|
|
|
|
map $realip_remote_addr $webp_suffix_cf {
|
|
default 0;
|
|
103.21.244.0/22 1;
|
|
103.22.200.0/22 1;
|
|
103.31.4.0/22 1;
|
|
104.16.0.0/12 1;
|
|
108.162.192.0/18 1;
|
|
131.0.72.0/22 1;
|
|
141.101.64.0/18 1;
|
|
162.158.0.0/15 1;
|
|
172.64.0.0/13 1;
|
|
173.245.48.0/20 1;
|
|
188.114.96.0/20 1;
|
|
190.93.240.0/20 1;
|
|
197.234.240.0/22 1;
|
|
198.41.128.0/17 1;
|
|
199.27.128.0/21 1;
|
|
2400:cb00::/32 1;
|
|
2405:8100::/32 1;
|
|
2405:b500::/32 1;
|
|
2606:4700::/32 1;
|
|
2803:f800::/32 1;
|
|
2a06:98c0::/29 1;
|
|
2c0f:f248::/32 1;
|
|
|
|
}
|
|
|
|
map $webp_suffix_cf$webp_suffix_valid $webp_suffix {
|
|
default "";
|
|
00 ".webp";
|
|
}
|
|
|
|
# Limit Request
|
|
limit_req_status 403;
|
|
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
|
|
limit_req_zone $binary_remote_addr zone=two:10m rate=10r/s;
|