Writing this on my mobile, during my vacation, cause I couldn't sleep, haha. So, my apologies for any grammar mistake.
Based on your delivered configuration, you are using both $skip_cache
and $no_cache
variables. Since the fastcgi_cache_bypass
and fastcgi_no_cache
directives both reference $skip_cache
, all conditions that should bypass the cache need to be set to set $skip_cache 1
.
[..]
# enable the skip cache rules above.
fastcgi_cache_bypass $skip_cache;
# This directive tells Nginx not to cache the response.
fastcgi_no_cache $skip_cache;
Due to this, the suspect here is set $no_cache 1
. It looks like a small mistake due to the use of different tutorials.
Thus, my suggestion for you is to change this:
# Woocommerce
# https://blog.khophi.co/my-ultimate-ncachewowo/
if ($request_uri ~* "/shop/|/shop.*|/shopping-cart/|/shopping-cart.*|/store.*|/cart.*|/my-account.*|/checkout.*|/addons.*|.*add-to-cart.*|.*empty-cart.*") {
set $no_cache 1;
}
Into this:
# Woocommerce
# https://blog.khophi.co/my-ultimate-ncachewowo/
if ($request_uri ~* "/shop/|/shop.*|/shopping-cart/|/shopping-cart.*|/store.*|/cart.*|/my-account.*|/checkout.*|/addons.*|.*add-to-cart.*|.*empty-cart.*") {
set $skip_cache 1;
}
Use the following command to test your configuration before restarting Nginx:
sudo nginx -t
And after that
sudo systemctl reload nginx
Have fun and great earnings with your shop!