Skip to content

Installing Lighttpd on Mac OS X Tiger with DarwinPorts

First of all, this tutorial assumes you’ve got DarwinPorts 1.0 installed. If you don’t, go to the [DarwinPorts web site][1] and download and install it.

[1]: http://darwinports.opendarwin.org

[Lighttpd][2] is a “secure, fast, compliant and flexible” web server currently popular with Ruby on Rails programmers:

>lighttpd is a secure, fast, compliant and very flexible web-server which has been optimized for high-performance environments. It has a very low memory footprint compared to other webservers and takes care of cpu-load.

[2]: http://www.lighttpd.net/

Unless you _just_ installed DP, you’ll also want to update your ports index before attempting to install lighttpd. You can do this by typing

sudo port selfupdate

in the Terminal.

Once that process completes, you should be able to install lighttpd by typing

sudo port install lighttpd

Note that lighttpd depends upon __zlib__ and __pcre__, so DarwinPorts will install them if you don’t already have them installed. I’ve also added two _variants_ to the Portfile, which should make building with ssl and/or mysql easier:

To build lighttpd with MySQL (for MySQL virtual hosting), add __+mysql__ to the end of the install command, like so:

sudo port install lighttpd +mysql

Please note: if you don’t already have mysql4 installed via DP, it will be automatically installed. I had some trouble building mysql on Mac OS X 10.4, until I found a hint that fixed it. In order to successfully build mysql, you’ll need to tell Mac OS X to use gcc3.3 instead of the default gcc4.0

sudo gcc_select 3.3

will do nicely. To revert back to gcc4.0 when all is complete:

sudo gcc_select 4.0

To build lighttpd with ssl, add __+ssl__ to the end of the install command:

sudo port install lighttpd +ssl

If you don’t already have OpenSSL installed via DP, it will be installed.

Finally, you can also chain the variants:

sudo port install lighttpd +mysql +ssl

to install lighttpd with both. That’s how I’ve got it currently installed on my machine.

Please let me know if you have any problems installing lighttpd with these directions!

10 Comments

  1. Bruce wrote:

    Would it be possible to add a postgresql8 variant as well?

    Posted on 25-Jul-05 at 5:52 am | Permalink
  2. Jake wrote:

    Does lighttpd do pgsql virtual hosting? I thought it only worked with mysql at the moment. I’ll take a look at the docs; if there’s a way to configure it with pg8, I’ll set it up.

    Posted on 26-Jul-05 at 8:50 am | Permalink
  3. gasgarage wrote:

    Hi, I’m trying to install lighttpd in Panther but I can’t. My knownless of linux/Unix is very limited. This is the point where I am, absolutely blocked:

    1. I’ve download dmg of DP. Installed like a charm.
    (I’ve added /opt/local/bin to PATH in /etc/profile)
    2. I’ve download lighttpd-1.3.15, extracted files, configure, make & make install..all correct (i guess)
    3. Now trying:
    a)port install lighttpd
    –>Port lighttpd not found
    b)port install lighttpd-1.3.15
    –>Port lighttpd not found
    c)port search lighttpd
    –>No match for lighttpd found
    c)port search lighttpd-1.3.15
    –>No match for lighttpd-1.3.15 found

    What I’m doing bad?

    Posted on 30-Jul-05 at 6:28 am | Permalink
  4. gasgarage wrote:

    Sorry, now I know that DP will make all those ugly things for me…

    But now I can’t find lighttpd-1.3.15 portfile at http://www.darwinports.com, neither at darwinports.opendarwin.org or even here.

    (DP is right now installing 1.3.14 finally)

    Posted on 30-Jul-05 at 8:35 am | Permalink
  5. Jake wrote:

    Yup, I’m testing a new Portfile with the update. I should have it submitted within the next few days.

    Posted on 30-Jul-05 at 4:16 pm | Permalink
  6. gasgarage wrote:

    Hi again Jake. First, I want to say about this blog has resulted very useful for me.

    Now I’m sucesfully with Ruby on Panther.
    I’ve been able to try it over WebRick (very simple and fast) and Apache 1.3 with fastCGI (a bit harder to setup),
    but I really don’t know how to use lighttp after installation. Isn’t there a lighttpd.conf anywhere?

    Posted on 04-Aug-05 at 12:15 am | Permalink
  7. Scotto wrote:

    GASGARAGE, there is a lighttpd.conf.sample file provided in the source builds of lighttpd; thus I’m not sure, but I presume that ports will stuff it into /usr/local/share/lighttpd- or somesuch.

    Posted on 22-Sep-05 at 11:03 pm | Permalink
  8. Wintermute wrote:

    Thanks for maintaining this Portfile!

    Looks like a lighttpd.conf file is missing from the DarwinPorts version. Not much work to copy it out of the original source tarball, but I’m sure you’ll add it when you have the time.

    Posted on 03-Oct-05 at 4:33 pm | Permalink
  9. Shane wrote:

    I did a sync and selfupdate, however, when I run sudo port install lighttpd, I get:

    ---> Fetching lighttpd
    ---> Attempting to fetch lighttpd-1.4.4.tar.gz from http://www.lighttpd.net//download/
    —> Attempting to fetch lighttpd-1.4.4.tar.gz from http://distfiles-od.opendarwin.org/
    —> Attempting to fetch lighttpd-1.4.4.tar.gz from http://distfiles-msn.opendarwin.org/
    —> Attempting to fetch lighttpd-1.4.4.tar.gz from http://distfiles-bay13.opendarwin.org/
    Error: Target com.apple.fetch returned: fetch failed

    Posted on 12-Nov-05 at 12:23 pm | Permalink
  10. Alison wrote:

    Ditto on Shane’s error above.

    Posted on 13-Nov-05 at 12:51 pm | Permalink

One Trackback/Pingback

  1. Unquiet » Lighttpd on DarwinPorts, too. on 17-Jun-05 at 10:08 am

    […] ficial maintainer for the DarwinPorts lighttpd port. I’ve posted a tutorial on using DP to install lighttpd on my blog… plea […]

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*