Giter Club home page Giter Club logo

Comments (6)

erus00 avatar erus00 commented on May 27, 2024

Hi Karl,

in 'etc/nginx/conf.d/custom/fpm-wordpress-cache-users.conf" I added "/cart/ " to:

if ($request_uri ~* "/cart/|/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
        set $skip_cache 1;
}

It seems to be working fine.
Would you think this is the best way to do it or would you advise otherwise?

Thanks

from nginx-more.

karljohns0n avatar karljohns0n commented on May 27, 2024

Hi,

You should be good with the following on WooCommerce:

if ( $cookie_woocommerce_items_in_cart = "1" ){
     set $skip_cache 1;
}

if ($request_uri ~* "/(cart|checkout|my-account)/*$") {
     set $skip_cache 1;
}

I will update the wordpress cache templates on next update to support WooCommerce.

Thanks

from nginx-more.

erus00 avatar erus00 commented on May 27, 2024

Hi Karl,

Thanks for that, I implemented it and it works perfectly.

Could you please let me know what is the best way to purge the cache by the terminal?

Visiting site_url/purge/ after putting my IP in /etc/nginx/conf.d/custom/admin-ips.conf is OK but I am looking for a more practical way that could also be used in a script.

Thank you very much.

from nginx-more.

karljohns0n avatar karljohns0n commented on May 27, 2024

Could you please let me know what is the best way to purge the cache by the terminal?

Add an alias such as: alias purge-nginx-cache="rm -rf /var/lib/nginx/cache/fastcgi/*"

Visiting site_url/purge/ after putting my IP in /etc/nginx/conf.d/custom/admin-ips.conf is OK but I am looking for a more practical way that could also be used in a script.

This plugin works well to clear single page cache after editing: https://en-ca.wordpress.org/plugins/nginx-helper/

Karl

from nginx-more.

erus00 avatar erus00 commented on May 27, 2024

Thanks Karl!

from nginx-more.

karljohns0n avatar karljohns0n commented on May 27, 2024

See commit 8434453.

from nginx-more.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.