New Year with new technologies – mostly lighttpd

My old VPS was kinda meeting it’s limits so I’ve decided to order new one.  Actually I’ve ordered new VPS a few months ago at Digital Ocean for a project I am not able to complete and won’t be ready for a few months, so I decided to use this server for this blog and several more domains.

Digital Ocean offers really great deals (20GB SSD & 512MB RAM for $5, really easy scalable) and after few months of testing I have no other choice than recommend. About creating droplets (means VPS) and managing web server maybe some other time, it’s like two clicks of mouse.

My old VPS is running LAMP (Linux, Apache 2, MySQL & PHP) and I’ve ordered only 512MB of RAM, I’ve decided to try Lighttpd instead of Apache just to save some memory. And it looks amazing.

At this very moment I’ve got three websites (powered by PHP framework – Nette), one WordPress site (this blog) and  flyspray site (bugtracking) on the VPS and it’s using 190MB of RAM.

The only thing I had to really resolve was the mod rewrite for WordPress. As a matter of fact it was really easy, check how to run wordpress on lighttpd.

Few hours ago I’ve  changed MX records and the blog is now running on the Lighty provided by Digital Ocean. Hooray.

WordPress on Lighty (lighttpd) with cool uri

If you wants to run WordPress site on Lighty (lighttpd) instead of Apache, you will find out that there is one little problem. Ligthy does not support .htaccess for mod_rewrite, so you will have to configure rewriting some other way. And it’s really simple, the only thing you really have to do is add this lines to your config file (/etc/lighttpd/lighttpd.conf):

        url.rewrite = (
                "^/(.*)\.(.+)$" => "$0",
                "^/(.+)/?$" => "/index.php/$1"
        )

And check if you have mod_rewrite enabled in the same config file:

server.modules = (
        "mod_access",
        "mod_accesslog",
        "mod_fastcgi",
        ... ,
        "mod_rewrite",
)

The complete record for this blog in lighttpd.conf is:

# this is the settings for blog subdomain running wordpress
$HTTP["host"] =~ "(blog\.)vyvazil\.eu$" {
        # these three lines below should be pointing at real paths 
        server.document-root = "/home/domains/vyvazil.eu/web/subdomains/blog/" 
        server.errorlog = "/home/domains/vyvazil.eu/web/log/error.log"
        accesslog.filename = "/home/domains/vyvazil.eu/web/log/access.log"

        url.rewrite = (
                "^/(.*)\.(.+)$" => "$0",
                "^/(.+)/?$" => "/index.php/$1"
        )
}

 Don’t forget to restart your web server after saving changes in configuration file.