Lighttpd, mod_magnet and MacPorts

  August 16th, 2009

I installed lighttpd with MacPorts using the usual command

sudo port install lighttpd

But when I try to start it with a custom configuration file, I get the following error:

(plugin.c.213) mod_magnet plugin init failed
(server.c.614) loading plugins finally failed

It looks like the default MacPorts installation didn’t install everything needed for mod_magnet to work. Ports actually come in different flavours called variants. You can either do

port variants lighttpd

to see the different variants of a port, or directly read lighttpd’s portfile which has more info in it. You see on line 85 that the cml variant builds lighttpd with lua, which is the scripting language used by mod_magnet:

variant cml {
    depends_lib-append   port:lua \
                         port:libmemcache \
                         port:memcached \
                         port:pkgconfig

     configure.args-append --with-lua \
                           --with-memcache
}

The cml variant is probably just what we need. While we’re at it, we are also going to add ssl support to our lighttpd installation.

Now, we first need to remove the previous installation

sudo port uninstall lighttpd

then do the new installation with the cml and ssl variants:

sudo port install lighttpd +cml +ssl

Lighttpd now starts without any error.

Leave a comment