Tricky Rewrite rules.

HonDev Developer developerhondev at gmail.com
Mon Nov 19 04:37:59 MSK 2007


WP Super Cache provides two forms of cache.  To random one off users a
static html file is served.

Here you can see the original php page of your blog that is
dynamically created plus the actual static html file that super cache
creates:

http://yourblog.com/blog/2007/08/20/post-permalink/
http://yourblog.com/wp-content/cache/supercache/yourblog.com/blog/2007/08/20/post-permalink/index.html

To regular users I think a statically cached query of the php is
served up and this still requires php.  These users include:

1. Users who are not logged in.
2. Users who have not left a comment on your blog.
3. Or users who have not viewed a password protected post.

When you turn gzip compression on Nginx will turn gzip on or off
depending on the HTTP request version.  So you would perhaps disable
gzip compression in wp-super-cache options and then allow nginx to
decide whether or not to compress the static html created by
wp-super-cache.

http://wiki.codemongers.com/NginxHttpGzipModule

On Nov 19, 2007 11:45 AM, HonDev Developer <developerhondev at gmail.com> wrote:
> By the way I don't think you'll need to  use the gzip component of
> wp-super-cache on nginx since nginx already has on the fly gzip.
> (compression as I understand it.)
>
>
>
>
> On Nov 19, 2007 11:18 AM, HonDev Developer <developerhondev at gmail.com> wrote:
> > I am also keen to get this working although this is above my ability
> > unfortunately.  Is there a way to pay Igor for this?
> >
> >
> > On Nov 19, 2007 3:54 AM, Gustavo Barrón <lists at ruby-forum.com> wrote:
> > > Hi,
> > >
> > > I was in need of some advice. I wanted to use a new cache plugin for
> > > Wordpress, that writes static files. But I can't setup the rules.
> > >
> > > The original .htaccess is something like this:
> > > -----------------
> > > RewriteEngine On
> > > RewriteBase /
> > > RewriteCond %{QUERY_STRING} !.*s=.*
> > > RewriteCond %{HTTP_COOKIE} !^.*comment_author_.*$
> > > RewriteCond %{HTTP_COOKIE} !^.*wordpressuser.*$
> > > RewriteCond %{HTTP_COOKIE} !^.*wp-postpass_.*$
> > > RewriteCond %{HTTP:Accept-Encoding} gzip
> > > RewriteCond
> > > %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1index.html.gz
> > > -f
> > > RewriteRule ^(.*)
> > > /wp-content/cache/supercache/%{HTTP_HOST}/$1index.html.gz [L]
> > >
> > > RewriteCond %{QUERY_STRING} !.*s=.*
> > > RewriteCond %{HTTP_COOKIE} !^.*comment_author_.*$
> > > RewriteCond %{HTTP_COOKIE} !^.*wordpressuser.*$
> > > RewriteCond %{HTTP_COOKIE} !^.*wp-postpass_.*$
> > > RewriteCond
> > > %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1index.html
> > > -f
> > > RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1index.html
> > > [L]
> > > -----------------
> > >
> > > Somehow I ended with this rules...
> > >
> > > -----------------
> > >   location / {
> > >     root        /var/www/mydomain.com/htdocs;
> > >     index      index.html index.php;
> > >
> > >     if ($request_uri ~* ".*s=.*") { rewrite ^(.*)$  /index.php$1  break;
> > > }
> > >     if ($http_cookie ~* "^.*comment_author_.*$" ) { rewrite ^(.*)$
> > > /index.php?q=$1 break; }
> > >     if ($http_cookie ~* "^.*wordpressuser.*$" ) { rewrite ^(.*)$
> > > /index.php?q=$1  break; }
> > >     if ($http_cookie ~* "^.*wp-postpass_.*$" ) { rewrite ^(.*)$
> > > /index.php?q=$1 break; }
> > >     if ($http_cookie ~* "^.*wordpressuser.*$" ) { rewrite ^(.*)$
> > > /index.php?q=$1 break; }
> > >     if (-f /wp-content/cache/supercache/mydomain.com/$1index.html ) {
> > >       rewrite ^(.*)$
> > > /wp-content/cache/supercache/mydomain.com/$1index.html last;
> > >     }
> > >
> > >     if (!-e $request_filename) {
> > >       rewrite ^(.*)$  /index.php?q=$1  last;
> > >     }
> > >   }
> > >
> > > -----------------
> > >
> > > I ommited the Gzip comprobation, mostly because I couldn't find how to
> > > verify the support on the client.
> > >
> > > Between all my iterations of the config I have encountered many weird
> > > stuff, like getting 404's, 500 and sometimes it returns the php directly
> > > instead of sending to the fcgi service.
> > >
> > > Anyway thanks for taking time to get to the bottom of this mail in the
> > > sea of mails in the mailing list and thanks in advance for any advise.
> > > --
> > > Posted via http://www.ruby-forum.com/.
> > >
> > >
> >
>





More information about the nginx mailing list