• I have W3TC installed on an Nginx web server on an MU installation of WordPress – my rewrite rules all seem to be correct and in place within my server configuration file as the plugin is generally working correctly.

    I have an issue with the minify module of this plugin though, it seems to be duplicating the document root when trying to locate the files to minify breaking this part of the plugin. When I debug the issue I get an error message like so:

    File "/var/www/domain.net/public/wp-content/w3tc-domain.net/min/var/www/domain.ne/public/wp-content/themes/theme/assets/js/jquery.mousewheel-3.0.6.js" doesn't exist.

    As you can see it’s duplicating this part of the file location:

    /var/www/domain.net/public/

    Does anyone know why this is happening and how I can go about fixing it? This happens when both minifying CSS and JS files. I’m using JSMin and the default CSS minifier, I’m using manual minify mode and all of the file URL’s are verified and correct.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Are you using the nginx rules that W3TC provides on the install tab?

    Thread Starter edcs

    (@edcs)

    I’ve configured W3TC to auto-install all the re-write rules into it’s own w3tc.conf file. It seems to pass the built in tests, but I still get this root directory duplication error.

    Thread Starter edcs

    (@edcs)

    Here’s the contents of my w3tc.conf file, which is included in the configuration file for this virtual host:

    # BEGIN W3TC Minify core
    rewrite ^/var/www/ecssrv.net/public/wp-content/w3tc(.*?)/min/w3tc_rewrite_test$ /var/www/ecssrv.net/public/wp-content/w3tc$1/min/index.php?w3tc_rewrite_test=1 last;
    rewrite ^/var/www/ecssrv.net/public/wp-content/w3tc(.*?)/min/(.+\.(css|js))$ /var/www/ecssrv.net/public/wp-content/w3tc$1/min/index.php?file=$2 last;
    # END W3TC Minify core
    # BEGIN W3TC Page Cache core
    rewrite ^(.*\/)?w3tc_rewrite_test$ $1?w3tc_rewrite_test=1 last;
    set $w3tc_rewrite 1;
    if ($request_method = POST) {
        set $w3tc_rewrite 0;
    }
    if ($query_string != "") {
        set $w3tc_rewrite 0;
    }
    if ($http_host != "ecssrv.net") {
        set $w3tc_rewrite 0;
    }
    set $w3tc_rewrite2 1;
    if ($request_uri !~ \/$) {
        set $w3tc_rewrite2 0;
    }
    if ($request_uri ~* "(sitemap(_index)?\.xml(\.gz)?|[a-z0-9_\-]+-sitemap([0-9]+)?\.xml(\.gz)?)") {
        set $w3tc_rewrite2 1;
    }
    if ($w3tc_rewrite2 != 1) {
        set $w3tc_rewrite 0;
    }
    set $w3tc_rewrite3 1;
    if ($request_uri ~* "(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|\/feed\/|wp-.*\.php|index\.php)") {
        set $w3tc_rewrite3 0;
    }
    if ($request_uri ~* "(wp\-comments\-popup\.php|wp\-links\-opml\.php|wp\-locations\.php)") {
        set $w3tc_rewrite3 1;
    }
    if ($w3tc_rewrite3 != 1) {
        set $w3tc_rewrite 0;
    }
    if ($http_cookie ~* "(comment_author|wp\-postpass|wordpress_\[a\-f0\-9\]\+|wordpress_logged_in)") {
        set $w3tc_rewrite 0;
    }
    if ($http_user_agent ~* "(W3\ Total\ Cache/0\.9\.2\.4)") {
        set $w3tc_rewrite 0;
    }
    set $w3tc_domain "";
    if ($http_host ~ ^(www\.)?([a-z0-9\-\.]+\.[a-z]+)\.?(:[0-9]+)?$) {
        set $w3tc_domain $2;
    }
    set $w3tc_ua "";
    set $w3tc_ref "";
    set $w3tc_ssl "";
    set $w3tc_enc "";
    if ($http_accept_encoding ~ gzip) {
        set $w3tc_enc _gzip;
    }
    set $w3tc_ext "";
    if (-f "$document_root/var/www/ecssrv.net/public/wp-content/w3tc-$w3tc_domain/pgcache/$request_uri/_index$w3tc_ua$w3tc_ref$w3tc_ssl.html$w3tc_enc") {
        set $w3tc_ext .html;
    }
    if ($w3tc_ext = "") {
      set $w3tc_rewrite 0;
    }
    if ($w3tc_rewrite = 1) {
        rewrite .* "/var/www/ecssrv.net/public/wp-content/w3tc-$w3tc_domain/pgcache/$request_uri/_index$w3tc_ua$w3tc_ref$w3tc_ssl$w3tc_ext$w3tc_enc" last;
    }
    # END W3TC Page Cache core
    # BEGIN W3TC Page Cache cache
    location ~ /var/www/ecssrv.net/public/wp-content/w3tc.*?/pgcache.*html$ {
        add_header X-Powered-By "W3 Total Cache/0.9.2.4";
        add_header Vary "Accept-Encoding, Cookie";
    }
    location ~ /var/www/ecssrv.net/public/wp-content/w3tc.*?/pgcache.*gzip$ {
        gzip off;
        types {}
        default_type text/html;
        add_header X-Powered-By "W3 Total Cache/0.9.2.4";
        add_header Vary "Accept-Encoding, Cookie";
        add_header Content-Encoding gzip;
    }
    # END W3TC Page Cache cache
    # BEGIN W3TC Browser Cache
    gzip on;
    gzip_types text/css application/x-javascript text/x-component text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
    location ~ \.(css|js|htc)$ {
        add_header X-Powered-By "W3 Total Cache/0.9.2.4";
    }
    location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ {
        add_header X-Powered-By "W3 Total Cache/0.9.2.4";
    }
    location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
        add_header X-Powered-By "W3 Total Cache/0.9.2.4";
    }
    # END W3TC Browser Cache

    Surely the issue is with the way W3TC figures out the document root of the .css and .js files it’s trying to minify though, rather than with the config file?

    Also you need to change your config so it is the same as the code you find on the Install page in the plugin. The paths are wrong. The minify rewrite should look like
    rewrite ^/wp-content/w3tc(.*?)/min/(.+\.(css|js))$ /wp-content/w3tc$1/min/index.php?file=$2 last;

    Thread Starter edcs

    (@edcs)

    Did you delete a reply? To answer the reply I got via e-mail, that config is what your plugin generated and if this issue has been addressed multiple times before how come I can’t seem to find any tutorials on how to fix it anywhere and why not provide a link to such answered questions?

    It’s possible that the plugin has issues with your server setup. Could you send a bug report from the Support page in the plugin so I can look into it further?

    Thread Starter edcs

    (@edcs)

    Support request sent ??

    I can’t correlate forum topics to tickets easily. Did we get this resolved?

    Thread Starter edcs

    (@edcs)

    I think this was solved in a subsequent release so the topic can be closed. I’m just waiting for the latest update to be released to see if it solves a different minify problem I’m having now.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘W3TC Minify Error – Duplicating Document Root’ is closed to new replies.