Hi all, I am currently working on my Wordpress blog, which is hosted on a VPS.NET VPS with Nginx as front end to Apache to serve static files, while Apache takes care of the PHP in FastCGI. This seems to be working great, however I haven't yet managed to have Nginx serve WP-SuperCache files as well, which I would like for maximum performance (I am not planning to completely replace Apache with Nginx right now because I've got a Virtualmin license and it does not support Nginx). I have tried a lot of rules found here and there but in the end none worked for me or I am missing something. If Apache is stopped, in fact, I can still get images, stylesheets and javascript delivered to the browser by Nginx directly. But if I try to surf the blog (with pages cached for sure by WP-SuperCache) with Apache stopped, all I get from Nginx is a "502 bad gateway". Any ideas would be greatly appreciated. Many thanks in advance.
It seems silly to run Nginx through Apache.
Set up Nginx to serve up the php and dynamic pages itself and you'll have a much faster service and won't have the problem where apache dies and leaves your webserver(Nginx) hanging.
If your admin panel doesn't support this, you probably should only be using apache in the first place. Either do one or the other, both is just asking for problems.
Hi Vito,
Nginx can handle your fastCGI. Bundled with Nginx, generally, all Apache does is cost you resources.
Regarding WP Super Cache, if you create a new file and paste this, it'll give you both that and, while we're about it, FURLs...
# 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;
}
Now, goto your virtual host file, or nginx.conf if you bundle your sites, and add a line like ..
# Wordpress WP Super Cache plugin and permalinks.
include /usr/local/nginx/conf/wordpress_params.super_cache;
.. where wordpress_params.super_cache is what you called the file we created, and given a path relative to that I've shown.
Then restart Nginx and turn on WP Super Cache plugin and, for the pretty links, add a permalink structure.
Fact is, there's a lot to know about to get the Nginx install right, especially with WordPress and to configure fastCGI. If you like, this would be a good start for you...
.. Setup WordPress on NGINX (FURLs & Cache) - VPS Bible Pt 13
Re. Virtualmin .. I understand you want a CP, but truth is, the resource cost is greater than the cost of the software .. plus it takes way longer to do stuff with a CP.
I'm currently publishing a 21 part VPS Admin series which addresses the lack of an Nginx CP .. that'll be all you need, frankly.
Given a week or two, I challenge you to tell me it's quicker or otherwise better to use a CP :)