Forums

Lack of Nginx support from WP Super Cache (4 posts)

  1. hollywoodgrind
    Member
    Posted 3 months ago #

    Very heavily trafficked Wordpress blogs are moving away from Apache to Nginx. In fact, Wordpress itself uses Nginx in their server mix.

    I've been waiting for the day when WP Super Cache would have a set of regular expressions for Nginx that match the /.htaccess and wp-content/cache/.htaccess Apache files. Currently the Nginx community uses the barebones regular expressions below for Super Cache:

    # if the requested file exists, return it immediately
                            if (-f $request_filename) {
                            break;
                            }
    
                            set $supercache_file '';
                            set $supercache_uri $request_uri;
    
                            if ($request_method = POST) {
                            set $supercache_uri '';
                            }
    
    # Using pretty permalinks, so bypass the cache for any query string
                            if ($query_string) {
                            set $supercache_uri '';
                            }
    
                            if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
                            set $supercache_uri '';
                            }
    
    # if we haven't bypassed the cache, specify our supercache file
                            if ($supercache_uri ~ ^(.+)$) {
                            set $supercache_file /wp-content/cache/supercache/$http_host/$1index.html;
                            }
    
    # only rewrite to the supercache file if it actually exists
                            if (-f $document_root$supercache_file) {
                            rewrite ^(.*)$ $supercache_file break;
                            }
    
                            # all other requests go to Wordpress
                            if (!-e $request_filename) {
                            rewrite . /index.php last;
                            }

    Donncha, could you provide translated files for Nginx in your next release? There are a lot of people who would greatly appreciate it.

  2. donncha
    Member
    Posted 3 months ago #

    I can add them to the readme.txt but every time I tried using nginx it failed so I'm stuck with Apache for the time being.

    The rules above work I presume but you're missing a tutorial on how to use them. I should link to one of the many tuts online that explain it :)

  3. helmi
    Member
    Posted 2 months ago #

    I just setup some servers with nginx and php-fpm running wordpress (and wordpress mu partly). I'm basically totally happy with that setup except i'm running into trouble getting supercache working.

    I'm using the above rules and already modified some stuff but it seems like it's not working properly. I'm getting new supercache time stamps in the source every time i refresh a page - strange stuff.

  4. guvnrDOTcom
    Member
    Posted 1 month ago #

    @donncha

    "I should link to one of the many tuts online that explain it"

    well, 'hem ... I hope these are handy links for those wishing to build WP on Nginx ..

    Nginx (better than Apache) Web Server - VPS BIBLE Part 11

    And for the WP bit ..

    Set up WordPress on Nginx with Pretty URLs & WP Super Cache - VPS BIBLE Part 14

    and ..

    WordPress Setup & Updates from the Command Line - VPS BIBLE Part 15

Reply

You must log in to post.

About this Topic