Configuring Lighttpd for WordPress with Rewrites

Today I had to configure a WordPress website to use Lighttpd. I looked for the proper rewrites to use and only received garbled information about the rewrites. So instead of forgetting it again for the umpteenth time, I will post my getting WordPress to work with Lighttpd tips / tricks here.

First up there are three key rewrites to get Lighttpd to work with WordPress. They are as follows: (note mod_rewrite will need to be enabled and this is in the lighttpd.conf).

url.rewrite = (
        "^/(wp-admin|wp-includes|wp-content)/(.*)" => "$0",
  "^/(.*).(.+)$" => "$0",
  "^/(.+)/?$" => "/index.php/$1"
)
									

The second key item is making sure that the error handler is set properly. The error handler in Lighttpd conf for a WordPress Blog should be:

server.error-handler-404 = "/index.php"
									

With those key items done, any WordPress site should work (I use the term should loosely). I recently converted a client from Apache2 to lighttpd because Apache2 was hitting 30.0 Load Average on the server! It was insane. Lighttpd is handling the load much better (2.0-3.0 Load Average) (at least it just takes a bit longer to load vs erroring. So that is our server tip / trick for the day. Hope you find it useful.

No Comments

Leave us a comment

No comment posted yet.

Leave a Comment

↑ BACK TO THE TOP ↑