2017-09-16 20:37:13 +00:00
# WPFC NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE Webinoly
2018-06-22 14:53:29 +00:00
2017-09-16 20:37:13 +00:00
set $skip_cache 0;
# POST requests and URL with a query string should always go to php
if ($request_method = POST) {
2018-06-22 14:53:29 +00:00
set $skip_cache 1;
2017-09-16 20:37:13 +00:00
}
if ($query_string != "") {
2018-06-22 14:53:29 +00:00
set $skip_cache 1;
2017-09-16 20:37:13 +00:00
}
2018-06-22 14:53:29 +00:00
2017-09-16 20:37:13 +00:00
# Don't cache URL containing the following segments
2018-06-22 14:53:29 +00:00
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|.*sitemap.*\.xml)") {
set $skip_cache 1;
2017-09-16 20:37:13 +00:00
}
2018-06-22 14:53:29 +00:00
2017-09-16 20:37:13 +00:00
# Don't use the cache for logged in users or recent commenter or customer with items in cart
2018-12-10 02:56:15 +00:00
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|[a-z0-9]+_items_in_cart|[a-z0-9]+_cart_hash") {
2018-06-22 14:53:29 +00:00
set $skip_cache 1;
2017-09-16 20:37:13 +00:00
}
2018-06-22 14:53:29 +00:00
2017-09-16 20:37:13 +00:00
# Use cached or actual file if they exists, Otherwise pass request to WordPress
location / {
2018-06-22 14:53:29 +00:00
try_files $uri $uri/ /index.php?$args;
2017-09-16 20:37:13 +00:00
}
location ~ \.php$ {
2018-06-22 14:53:29 +00:00
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache WORDPRESS;
2017-09-16 20:37:13 +00:00
}