Running BackupPC with lighttpd instead of Apache

I have been running BackupPC to back up jails on a FreeBSD box for a while now and been very satisfied with its stability. However recently I ran into problems with upgrading Apache, which is used as an optional web interface for BackupPC.

I was under the mistaken impression that BackupPC’s frontend only worked with Apache, so when I found instructions on the ArchLinux wiki to run it on lighttpd instead, I gave it a try on FreeBSD, and with these few changes to the configuration it runs just fine:

  1. Delete Apache:

    pkg delete backuppc apache22
  2. Delete dependencies installed for Apache:

    pkg autoremove
  3. Install lighttpd:

    pkg install lighttpd
  4. Edit lighttpd’s configuration:

    vi /usr/local/etc/lighttpd/lighttpd.conf
    server.port = 81
    server.username  = "backuppc"
    server.groupname = "backuppc"
    server.document-root = "/usr/local/www/data/"
    server.errorlog             = "/var/log/lighttpd/error.log"
    dir-listing.activate = "enable"
    index-file.names = (  "index.html", "index.cgi" )
    server.modules = ("mod_alias", "mod_cgi", "mod_auth", "mod_access") = "/var/run/lighttpd/"
    alias.url = ("/BackupPC_Admin" => "/usr/local/www/cgi-bin/BackupPC_Admin")
    alias.url += ("/backuppc" => "/usr/local/www/backuppc" )
    cgi.assign += (".cgi" => "/usr/bin/perl" )
    cgi.assign += ("BackupPC_Admin" => "/usr/bin/perl")
    server.event-handler = "freebsd-kqueue" = "writev"
    server.max-fds = 2048
    server.stat-cache-engine = "simple"
    server.max-connections = 1024
    url.access-deny             = ( "~", ".inc" )
    static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" )
  5. Edit rc.conf:

    vi /etc/rc.conf
    # ... other lines, such as (obviously) ...
  6. Give backuppc user access to log and pid directories:

    mkdir /var/run/lighttpd
    chown -R backuppc: /var/log/lighttpd
    chown -R backuppc: /var/run/lighttpd
  7. Start lighttpd:

    service lighttpd start

freebsd backuppc lighttpd