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.
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.)
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:
To regular users I think a statically cached query of the php is
served up and this still requires php. These users include:
Users who are not logged in.
Users who have not left a comment on your blog.
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.
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.)
Yeah I forgot to tell that nginx is already serving gzip files, but on
big scenarios, with many users, serving a precompressed file instead of
doing it on the fly, would help greatly on the performance.
also insted of:
if (-f /wp-content/cache/supercache/mydomain.com/$1index.html ) {
rewrite ^(.*)$
But obviously returns a error, is there a way of a) setting a variable
on nginx b)escape the i on index.html in order to separate the variable
from the text when the config is parsed.
Ok so the apache rewrite rules are basically saying this.
If its not a search (s=.) redirect the wordpress permalink to the static
html file.
If there’s not a cookie with comment_author_ in it redirect the
wordpress permalink to the static html file.
If there’s not a cookie with wordpressuser, wp-postpass_ etc
Wouldn’t something more like this be the way to do it:
if ($query_string !~ “.s=.”) {
rewrite ^(.*) /wp-content/cache/supercache/$http_host/$1index.html;
}
if ($http_cookie !~ “^.comment_author_.$” ) {
rewrite ^(.*) /wp-content/cache/supercache/$http_host/$1index.html;
}
if ($http_cookie !~ “^.wordpressuser.$” ) {
rewrite ^(.*) /wp-content/cache/supercache/$http_host/$1index.html;
}
if ($http_cookie !~ “^.wp-postpass_.$” ) {
rewrite ^(.*) /wp-content/cache/supercache/$http_host/$1index.html
break;
}
Well that does work, if first the file exists. But before that I have to
check for the existence of the file with a if, but I cant have recursive
if’s. Handling the string’s and queries is not difficult, But Im having
problems after doing the if’s for query’s and cookies.
To be more specific:
if (-f /wp-content/cache/supercache/mydomain.com/$1index.html ) {
rewrite ^(.*)$
I was thinking that, but apparently, after a couple of tries today, it
seems, the problem resides partially on wp-super-cache, carrying on a
bug from wp-cache with php 5.2.x and fastgi. I will check it later today
in order to see How can be fixed that.
But actually is a good idea. I was thinking on something similar after
reviewing a RoR site this morning. I will check it later as an
alternative. Because my fix for wp-cache/wp-super-cache requires
patching
I have not had problems with wp-cache on php 5.2.x and fastcgi. I
have wp-cache running fine on some other single wordpress installs.
I tried setting up a new mu wordpress install but got a 405 error with
the config. Wordpress entered the upstream name “bugaloo” in the
install set up by default.
upstream bugaloo {
server 127.0.0.1:81;
}
server {
listen 80;
server_name xx.yy.zz.com;
location / {
root /home/monkeyking/public_html;
index index.html;
if ($query_string !~ “.s=.”) {
rewrite ^(.*) /wp-content/cache/supercache/$http_host/$1index.html;
}
if ($http_cookie !~ “^.comment_author_.$” ) {
rewrite ^(.*) /wp-content/cache/supercache/$http_host/$1index.html;
}
if ($http_cookie !~ “^.wordpressuser.$” ) {
rewrite ^(.*) /wp-content/cache/supercache/$http_host/$1index.html;
}
Ok with this set up it serves static pages but if there is none it
serves the wordpress php 404 error pages for any request. It’s making
it through to the proxy php but category and permalink pages are all
wordpress 404 page. Maybe this idea doesn’t work?
Ok if I remove the rewrites on server port 81 and put them at location @tricky I get the index page rendering perfectly but when I click on
to about page /about/ and hello world /hello-world/ it just remains on
the index page.