atom feed20 messages in ru.sysoev.nginxRe: Tricky Rewrite rules.
FromSent OnAttachments
Gustavo BarrónNov 18, 2007 8:53 am 
HonDev DeveloperNov 18, 2007 4:17 pm 
HonDev DeveloperNov 18, 2007 4:44 pm 
HonDev DeveloperNov 18, 2007 5:37 pm 
Gustavo BarrónNov 18, 2007 10:30 pm 
HoneNov 20, 2007 12:15 pm 
HoneNov 20, 2007 1:30 pm 
Gustavo BarrónNov 20, 2007 2:15 pm 
HoneNov 20, 2007 8:29 pm 
HoneNov 20, 2007 8:46 pm 
HoneNov 21, 2007 6:01 pm 
Gustavo BarrónNov 21, 2007 6:50 pm 
HonDev DeveloperNov 22, 2007 3:46 am 
HonDev DeveloperNov 22, 2007 4:05 am 
HonDev DeveloperNov 22, 2007 4:23 am 
HonDev DeveloperNov 22, 2007 3:17 pm 
HonDev DeveloperNov 26, 2007 2:41 am 
HonDev DeveloperNov 26, 2007 2:44 am 
HonDev DeveloperApr 24, 2008 12:26 am 
HonDev DeveloperApr 24, 2008 1:41 am 
Subject:Re: Tricky Rewrite rules.
From:HonDev Developer (deve@public.gmane.org)
Date:Nov 18, 2007 4:44:52 pm
List:ru.sysoev.nginx

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.)

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
<list@public.gmane.org> 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.