Skip to content

Running BackupPC with lighttpd instead of Apache

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:

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

    Terminal window
    pkg autoremove
  3. Install lighttpd:

    Terminal window
    pkg install lighttpd
  4. Edit lighttpd’s configuration:

    Terminal window
    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")
    server.pid-file = "/var/run/lighttpd/lighttpd.pid"
    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"
    server.network-backend = "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:

    Terminal window
    vi /etc/rc.conf
    lighttpd_enable="YES"
    lighttpd_pidfile="/var/run/lighttpd/lighttpd.pid"
    # ... other lines, such as (obviously) ...
    backuppc_enable="YES"
  6. Give backuppc user access to log and pid directories:

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

    Terminal window
    service lighttpd start