WordPress.org

Forums

W3 Total Cache
NGINX support (11 posts)

  1. John Robertson
    Member
    Posted 4 years ago #

    Hey,
    So I read that official NGINX support wont be available till version 1.0... so what can I do to set up the rewrite rules in the mean time to get it running on an NGINX only setup?

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

  2. Joost Schuur
    Member
    Posted 4 years ago #

    I've tested it out on a DreamHost PS using ngnix and Xcache, and it works just fine, at least based on speed improvements and the footer info on pages.

    If you're using disk based caching instead of an opcode solution like Xcache, it's simply a matter or changing one line in the SuperCache nginx instructions (lines 23-49 in that post). Just change line 40, so it reads:

    `set $supercache_file /wp-content/w3tc/pgcache/$1/_index.html;

    Your rewrite rule now matches the directory structure under which the cached files are created with W3 Total Cache.

  3. John Robertson
    Member
    Posted 4 years ago #

    Works for me but Im completely APC, so no need to do any rule rewrites.

  4. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    Every implementation of nginx rules I've ever seen is complete. Please keep in mind that you will get erratic behavior until nginx is officially supported.

  5. John Robertson
    Member
    Posted 4 years ago #

    Im using APC, which I believe doesnt need mod rewrite rules. I cant take advantage of browser caching though since I dont want to mess around too much with the Virtual host commands... I rather wait for version 1...

  6. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    Sorry I meant to say "incomplete" earlier. Anyway, you're all set for now then if you're using APC (except for browser cache obviously).

  7. @braddor

    You can take advantage of browser caching my adding expires max; to your server file making sure to only apply it to images, css or js by adding this to your server file:

    server {
            listen 80;
    
            server_name  www.xxxxxxx.com xxxxxxxxx.com;
            access_log  /var/log/nginx/xxxxxxx.proxied.log;
    
            # Serve directly:  /images/ + /css/ + /js/
            #
            location ^~ /(images|css|js) {
                    root   /srv/www/xxxxxxxx/public_html/;
                    access_log  /var/log/nginx/xxxxxx.direct.log ;
    expires     max;
            }
            # Serve directly: *.js, *.css, *.rdf,, *.xml, *.ico, & etc
            #
            location ~* \.(js|css|rdf|xml|ico|txt|gif|jpg|png|jpeg)$ {
                    root   /srv/www/xxxxxxxx.com/public_html/;
                    access_log  /var/log/nginx/xxxxxxxx.direct.log ;
    
    expires     max;
            }

    This would be added before your PHP directives.

    Also take a look at the Nginx Compatability plugin. I have used it in conjunction with W3-Total cache and there are no conflicts. The other option is to use nginx as a front end proxy to serve static files and pass everything else to Apache.

  8. John Robertson
    Member
    Posted 4 years ago #

    Thanks c3mdigital. My server is pure NGINX though....i decided to ditch apache (using php-fpm). I should still be fine though right?

  9. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    Right @c3mdigital ? :)

  10. @braddor

    If your using Nginx on its own the plugin will make WordPress think you have mod_rewrite enabled and allow you to use pretty permalinks.

    There is a sample server config file included with the plugin and a very good article on using Nginx with php-fpm and Apc here:

    http://interfacelab.com/nginx-php-fpm-apc-awesome/

  11. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    Formal nginx support is currently scheduled for 0.9.5 release.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • W3 Total Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic