Support » Plugin: W3 Total Cache » Please include nginx rewrite rules for apache users

Viewing 2 replies - 1 through 2 (of 2 total)
  • After doing some testing, I found some interesting results.

    If you let nginx handle all incoming connections and just proxypass php files to apache, pingdom.com was showing load times of 1.8 -> 2.2 ms – which is really good.

    However, I decided to add in the following config to see what would happen

    # Set a variable to work around the lack of nested conditionals
             set $cache_uri $request_uri;
    
             # POST requests and urls with a query string should always go to PHP
             if ($request_method = POST) {
                set $cache_uri 'no cache';
             }
             if ($query_string != "") {
                set $cache_uri 'no cache';
             }
    
             location / {
                try_files /wp-content/cache/page_enhanced/$host/$cache_uri/_index.html $uri @backend;
             }

    @backend is my block that handles passing php requests off to apache for processing.

    This is what pingdom.com shows now : http://i49.tinypic.com/2ngzif4.png

    The difference is night and day! The blog pages load instantly – no more ~1.5 sec pause before the content displays.

    So if your running a similar setup (nginx up front, apache backend) you should really mess around with the ‘try_files” directive and get it to check for the static resource first.

    Nice example. Thanks for sharing the code.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Please include nginx rewrite rules for apache users’ is closed to new replies.