lighttpd & multi-site drupal & clean URLs

[another refugee from slicehost here, just beginning the process of transferring my sites across to my new linode]

sorry if this has been covered before. i did do a search but nothing jumped out at me:

as well, as changing from slicehost to linode, i've also decided to be adventurous and try out lighttpd instead of apache2 this time. i've got lighttpd/php/mySQL up and running OK for a couple of pretty static site domains i've brought across, but next comes the biggy; i have a multi-site drupal 6 installation on my slicehost, which is serving up three or four separate websites all running on their own domains. that's next in line to bring over to my linode.

now, since lighttpd disnae do clean URLs 'out of the box', i'm wondering if anyone can point me in the right direction for some info that would help me suss this out. it will need to be real beginner stuff tho' - although i'm reasonably OK with setting this stuff up in apache, this morning was the first time i ever rested my gaze upon a lighttpd config file, so this is all new to me.

unfortunately, most of the tutorials i've turned up by googling seem to assume that you already work with lighttpd, so they'll say to 'add such-and-such' to your lighttpd config file, but not explain where to add it, or whether it has to appear inside $HTTP["host"] directives, or whatever.

so, until i get up to speed with lighttpd, assume you're dealing with a moron here. :?

finally - has anyone who's already 'been there. done that & got the t-shirt' got any other 'gotchas' i should watch out for, when getting a multi-site drupal installation up and running on lighttpd.

thanking you in advance. :mrgreen:

1 Reply

I am running Drupal in multisite installation with Lighttpd and had no problems so far. I cannot provide you a step-by-step tutorial but the key steps involved.

You will need the mod_magnet module. On Ubuntu I only installed the lighttpd-mod-magnet package and enabled it with lighty-enable-mod.

You will need this lua script which tells mod_magnet how to deal with the urls.

For me a typical virtualhost on lighttpd with Drupal multisite looks like:

`$HTTP["host"] =~ "^(example1|example2)\.com$" {
    $HTTP["host"] == "" { = ""
    $HTTP["host"] == "" { = ""
    accesslog.filename = "/path/to/your/access.log"
    server.document-root = "/path/to/your/document_root/"
    url.access-deny = ( "~", ".engine", ".inc", ".info", ".install", ".module", ".profile", ".test", ".po", ".sh", ".sql", ".mysql", ".theme", ".tpl.php", ".xtmpl", "Entries", "Repository", "Root" )
    index-file.names = ( "index.php" )

    # for Drupal clean urls
    magnet.attract-physical-path-to = ( "/path/to/drupal.lua" )

    # "Fix" for Drupal SA-2006-006 (but let imagecache work)
    $HTTP[url] =~ "^(\/sites\/(.*)\/files\/)" {
        $HTTP[url] !~ "^(\/sites\/(.*)\/files\/imagecache\/)" {
            fastcgi.server = ()

    # Deny access to backup_migrate module dumps
    $HTTP[url] =~ "^(\/sites\/(.*)\/files\/backup_migrate\/)" {
        url.access-deny = ("")

This configuration is pretty much generic to some of my Drupal installations. As you can see you will have to set variables according to the actual domain name to give Drupal what he wants. Additionally there are two contrib module specific configurations, one for imagecache and one for the backup_migrate module. These can be safely ignored if you don't use these modules.

This config above does not cover multiple domains pointing to the same multisite. If you need those you will have to change to configuration accordingly.

One more important thing, this is only tested with multisites where each site was on a separate subdomain or domain. I have never used multisites in subdirectories so you might have to adjust the configuration (both the lighttpd.conf and the lua script) accordingly.[/url][/url][/url]


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct