WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
Please include nginx rewrite rules for apache users (3 posts)

  1. Mayhem30
    Member
    Posted 1 year ago #

    Could you please include an option to display the nginx rewrite rules in the install tab (or add a hidden ?page=w3tc_install_nginx) page for us Apache users that would rather have our nginx 'frontend' handle the rewrites?

    Thank you.

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

  2. Mayhem30
    Member
    Posted 1 year ago #

    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.

  3. Pothi
    Member
    Posted 1 year ago #

    Nice example. Thanks for sharing the code.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags