• Resolved cheonmu

    (@cheonmu)


    hello. I’m running a WordPress website on Ubuntu + Php-fpm + Nginx + Mariadb environment.

    Recently, I was looking up about the usage of W3 cache and came across the following code in this post.

    #W3 TOTAL CACHE CHECK
    set $cache_uri $request_uri;
    
    # POST requests and urls with a query string should always go to PHP
    if ($request_method = POST) {
        set $cache_uri 'null cache';
    }
    if ($query_string != "") {
        set $cache_uri 'null cache';
    }
    
    # Don't cache uris containing the following segments
    if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
        set $cache_uri 'null cache';
    }
    
    # Don't use the cache for logged in users or recent commenters
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
        set $cache_uri 'null cache';
    }
    #ADD mobile rules from WP SUPER CACHE section above
    
    #APPEND A CODE BLOCK FROM BELOW...
    
    
    location / {
        try_files /wp-content/w3tc-$host/pgcache/$cache_uri/_index.html $uri $uri/ /index.php?$args;
    }
    

    The nginx rule that appears when installing W3 total cache does not include this code, but is it good to apply it together?

    And I do all my browser caching configuration in Nginx + Brotil, Can I omit the # BEGIN W3TC Browser Cache rule in this case?

    Or do I need to add the following rule to my setup?

    
    etag on;     
    if_modified_since exact;     
    try_files $uri $uri/ /index.php?$args; 
    
    

    Thank you.

    • This topic was modified 2 years, 3 months ago by cheonmu.
    • This topic was modified 2 years, 3 months ago by cheonmu.
    • This topic was modified 2 years, 3 months ago by cheonmu.
Viewing 1 replies (of 1 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @cheonmu

    Thank you for reaching out and I am happy to help!

    There is no need to add those rules. If you do not want to use the W3TC BC rules, you can disable the entire module, or the individual settings within the Performance>Browser Cache and use any custom rules.

    Thanks!

Viewing 1 replies (of 1 total)

The topic ‘Do I need to apply Nginx rules separately?’ is closed to new replies.