• Yesterday I changed my (Dreamhost) server from Apache to nginx configuration.

    WordPress is working fine after adding the text to the ‘wordpress.conf’ file as suggested by Dreamhost, however W3 Total Cache is seeing some errors.

    Red error messages are appearing at the top of my W3TC settings screens saying:

    It appears Page Cache URL rewriting is not working. If using apache, verify that the server configuration allows .htaccess or if using nginx verify all configuration files are included in the configuration.

    and

    It appears Minify URL rewriting is not working. If using apache, verify that the server configuration allows .htaccess or if using nginx verify all configuration files are included in the configuration.

    Also, it seems that W3TC is no longer recognising the cahce method of ‘memcached’, which I installed on my server prior to changing from Apache to nginx.

    Can anyone suggest a fix for these issues? Happy to answer any questions about my setup.

    http://wordpress.org/extend/plugins/w3-total-cache/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter stuartmcmillen

    (@stuartmcmillen)

    Also, I was wondering if the advice on this blog post is still valid.

    The author is suggesting that adding his customised code to the nginx .conf file will work better than the W3TC default, as it uses ‘if’ less in the code to follow nginx best practices. Has Frederic made any recent changes to the W3 Total Cache support for nginx which makes his argument outdated?

    Plugin Contributor Frederick Townes

    (@fredericktownes)

    If you check the installation tab of the plugin you can see the recommended .conf for nginx there based on your current settings. The file can also be output to the path of your choosing.

    I upgraded recently and had to update my rewrite config. I copied the code from the install page and it did not work. After some troubleshooting I found that the following line seemed to be reversed:

    if (-f "$document_root/wp-content/cache/page_enhanced/$http_host/$request_uri/_index.html$w3tc_enc") {
    set $w3tc_rewrite 0;
    }

    It works much better when I changed it to:

    if (!-f "$document_root/wp-content/cache/page_enhanced/$http_host/$request_uri/_index.html$w3tc_enc") {
    set $w3tc_rewrite 0;
    }

    It seems that the rewrite should be disabled if the file does _not_ exist.

    gospelbass’s fix seems to fix the problem I was seeing. Good catch.

    I discovered the same thing myself, but this should probably be fixed in the rewrite rules generation:

    In PgCacheAdmin.php, the following lines are generated for an nginx conf file:

    924             $rules .= "if (!-f \"\$document_root" . $uri_prefix . ".html" .
     925                 $env_w3tc_enc . "\") {\n";
     926             $rules .= "  set \$w3tc_rewrite 0;\n";
     927             $rules .= "}\n";
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: W3 Total Cache] Changed from Apache to nginx: some errors’ is closed to new replies.