Welcome! Log In Create A New Profile

Advanced

Nginx and W3 Total Cache

Posted by rahul286 
Nginx and W3 Total Cache
April 19, 2010 07:10AM
Hi, I am administrating many wordpress MU site with very heavy traffic.
I typically work on Ubuntu+Nginx+PHP FastCGI+Wordpress+Wp-Super Cache and I am really impressed with overall performance.

Now some sites are growing more and more, and I guess replacing "Wp-Super-Cache" with "W3 Total Cache" will be a big added bonus.

My biggest problem is that "W3 Total Cache" does not provides nginx rewrite rules and their apache rewrite rules are bit complex for me.

Can anyone help me out migrating following apache .htaccess rules to nginx config?

[code]
# BEGIN W3 Total Cache
<IfModule mod_setenvif.c>
SetEnvIfNoCase Host ^(www\.)?([a-z0-9\-\.]+\.[a-z]+)\.?(:[0-9]+)?$ DOMAIN=$2
SetEnvIfNoCase Accept-Encoding (gzip) APPEND_EXT=.$1
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} \/$
RewriteCond %{REQUEST_URI} !(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register).php|wp-.*\.php|index\.php) [OR]
RewriteCond %{REQUEST_URI} (wp-comments-popup\.php|wp-links-opml\.php|wp-locations\.php) [NC]
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_COOKIE} !(comment_author|wp-postpass|wordpress_\[a-f0-9\]\+|wordpress_logged_in) [NC]
RewriteCond %{HTTP_USER_AGENT} !(bot|ia_archive|slurp|crawl|spider) [NC]
RewriteCond /var/www/rtcamp.com/wp-content/w3tc-%{ENV:DOMAIN}/pgcache/$1/_default_.html%{ENV:APPEND_EXT} -f
RewriteRule (.*) wp-content/w3tc-%{ENV:DOMAIN}/pgcache/$1/_default_.html%{ENV:APPEND_EXT} [L]
</IfModule>
# END W3 Total Cache
[/code]

I never encountered apache's mod_setenvif in my life so I am really clueless about its nginx counterpart as well.
Any hint for above .htaccess rules?

Thanks all,
-Rahul

--
Rahul Bansal
EasyEngine - https://github.com/rtCamp/easyengine
Re: Nginx and W3 Total Cache
June 15, 2010 02:36AM
Hi Rahul,

Were you able to get W3 Total Cache running on your MU installation?
Re: Nginx and W3 Total Cache
June 20, 2010 08:09PM
FYI nginx will be officially supported in W3 Total Cache after v0.9 (next month at the latest).
Re: Nginx and W3 Total Cache
June 21, 2010 06:49AM
I manage to write working nginx conf for w3 total cache last night.
Posted it on my blog - http://wpveda.com/nginx-rewrite-rules-for-w3-total-cache-plugin/

--
Rahul Bansal
EasyEngine - https://github.com/rtCamp/easyengine
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 197
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready