Title: [Plugin: W3 Total Cache] Changed from Apache to nginx: some errors
Last modified: August 20, 2016

---

# [Plugin: W3 Total Cache] Changed from Apache to nginx: some errors

 *  [stuartmcmillen](https://wordpress.org/support/users/stuartmcmillen/)
 * (@stuartmcmillen)
 * [14 years ago](https://wordpress.org/support/topic/plugin-w3-total-cache-changed-from-apache-to-nginx-some-errors/)
 * 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/](http://wordpress.org/extend/plugins/w3-total-cache/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [stuartmcmillen](https://wordpress.org/support/users/stuartmcmillen/)
 * (@stuartmcmillen)
 * [14 years ago](https://wordpress.org/support/topic/plugin-w3-total-cache-changed-from-apache-to-nginx-some-errors/#post-2758900)
 * Also, I was wondering if the advice on [this blog post](http://elivz.com/blog/single/wordpress_with_w3tc_on_nginx/)
   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](https://wordpress.org/support/users/fredericktownes/)
 * (@fredericktownes)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-changed-from-apache-to-nginx-some-errors/#post-2759241)
 * 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.
 *  [gospelbass](https://wordpress.org/support/users/gospelbass/)
 * (@gospelbass)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-changed-from-apache-to-nginx-some-errors/#post-2759242)
 * 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.
 *  [kyrra](https://wordpress.org/support/users/kyrra/)
 * (@kyrra)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-changed-from-apache-to-nginx-some-errors/#post-2759243)
 * gospelbass’s fix seems to fix the problem I was seeing. Good catch.
 *  [sidoh](https://wordpress.org/support/users/sidoh/)
 * (@sidoh)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-changed-from-apache-to-nginx-some-errors/#post-2759244)
 * 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.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

 * 5 replies
 * 5 participants
 * Last reply from: [sidoh](https://wordpress.org/support/users/sidoh/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-changed-from-apache-to-nginx-some-errors/#post-2759244)
 * Status: not resolved