• Hi All,
    I own a website name customerservicehub.in and I have installed wordpress w3 total cache plugin with nginx server.

    This is my nginx conf for domain

    server {
            server_name customerservicehub.in;
            root /server/customerservicehub.in/public_html;
    
            index index.php;
    
            include global/restrictions.conf;
    
            ##SITEMAP RULES WITHOUT CACHE
            location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ {
            rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent;
            rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last;
            rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
            rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?site$
            rewrite ^/news_sitemap\.xml$ /index.php?sitemap=wpseo_news l$
            rewrite ^/locations\.kml$ /index.php?sitemap=wpseo_local_kml$
            rewrite ^/geo_sitemap\.xml$ /index.php?sitemap=wpseo_local l$
            rewrite ^/video-sitemap\.xsl$ /index.php?xsl=video last;
      access_log off;
    }

    ##SITEMPA RULES WITHOUT CAHCE ENDS

    # Additional rules go here.

    #including w3 totalcache rules here
    include global/customerservicehub.in-w3tc.conf;
    # Only include one of the files below.
    include global/wordpress.conf;
    # include global/wordpress-ms-subdir.conf;
    }`

    <blockquote>My conf for w3 total cache</blockquote>

    # BEGIN W3TC Page Cache core
    set $w3tc_rewrite 1;
    if ($request_method = POST) {
        set $w3tc_rewrite 0;
    }
    if ($query_string != "") {
        set $w3tc_rewrite 0;
    }
    if ($request_uri !~ \/$) {
        set $w3tc_rewrite 0;
    }
    if ($http_cookie ~* "(comment_author|wp\-postpass|w3tc_logged_out|wo$
        set $w3tc_rewrite 0;
    }
    if ($http_cookie ~* "(w3tc_preview)") {
        set $w3tc_rewrite _preview;
    }
    set $w3tc_enc "";
    if ($http_accept_encoding ~ gzip) {
        set $w3tc_enc _gzip;
    }
    if (!-f "$document_root/wp-content/cache/page_enhanced/$http_host/$r$
      set $w3tc_rewrite 0;
    }
    if ($w3tc_rewrite = 1) {
        rewrite .* "/wp-content/cache/page_enhanced/$http_host/$request_$
    }
    # END W3TC Page Cache core

    <blockquote>This are the permissions i set for wp-content folder</blockquote>
    drwxr-xr-x 9 www-data www-data 4096 Jun 16 15:04 wp-content

    Can you please resolve my issue as to how would i be able to make w3 total cache work.
    I don’t find any cache files in cache folder of wp-content.

  • The topic ‘W3 total cache not working in nginx server’ is closed to new replies.