Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

If I use Lighttpd as webserver, how can I use caching plugin like w3 total cache or wp super cache? Need your help for configuring lighttpd.


share|improve this question

2 Answers 2

up vote 1 down vote accepted

The following script takes the url that was asked from the client. It checks whether there is a fresh version of a static HTML page on the cache and if yes, it servers that. If the file does not exist at all or the it is expired(I check its modification date) then the request is forwarded to the PHP fcgi so that it can be freshly served.

This is for Wp Super Cache.

  1. Download the latest version of the rewrite.lua script from this github project site.

  2. Place rewrite.lua in the root directory of your WordPress installation, i.e., the same directory where you find the WordPress PHP files such as wp-config.php.

  3. Update your lighttpd config file for the host running WordPress and include this command: magnet.attract-physical-path-to = ( server.document-root + "/rewrite.lua" )

  4. Make sure the Mobile device support option of the WP Super Cache plugin is enabled and the Rejected User Agents list is up-to-date. You’ll find those options in the Settings -> WP Super Cache menu of WordPress once WP Super Cache has been activated.

The lighttpd host configuration should now look somewhat similar to this:

$HTTP["host"] == "myblog.com" {
  server.document-root = “/srv/www/myblog/wordpress”
  accesslog.filename = “/var/log/lighttpd/myblog/access.log"
  magnet.attract-physical-path-to = ( server.document-root + “/rewrite.lua” )
share|improve this answer

Nginx has better support. http://wiki.nginx.org, http://wiki.nginx.org/Wordpress

The WP Super Cache plugin developer has the Nginx rewrite rules for his plugin on his blog: http://ocaoimh.ie/2009/11/23/wordpress-nginx-wp-super-cache/

share|improve this answer
I couldn't agree more! just the facts that wordpress.com uses Nginx is strong enough to use it! –  Pontus Abrahamsson Jun 12 '12 at 12:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.