How-To: BackupPC with lighttpd on debian lenny

This is the way I set up BackupPC with lighttpd on lenny...

Install package:

apt-get install backuppc

In this process, apt-get will automatically install apache2 package (if not already installed), but if you don't need it, remove it with:

apt-get remove apache2*
apt-get autoremove

Edit file /etc/lighttpd/lighttpd.conf and add "mod_cgi" to server.modules section.

Add "default.cgi" to index-file.names section.

Add this lines to the end of the file:

cgi.assign = ( ".cgi" => "/usr/bin/perl")
alias.urlĀ  += ( "/backuppc" => "/usr/share/backuppc/cgi-bin" )

Save the file and reload lighttpd config:

/etc/init.d/lighttpd reload

You should be now able to access BackupPC through address:
http://\<host_address>/backuppc/

Authentication

Create a password file:

vi /etc/lighttpd/passwd

with content:

backuppc:mypassword

(in this example, we will use plain text for password, but you can also use different methods like htpasswd, just later change 'backend' auth param)

Change permissions:

chown www-data:www-data /etc/lighttpd/passwd
chmod 700 /etc/lighttpd/passwd

Edit file /etc/lighttpd/lighttpd.conf and this line to section server.modules, if already don't exists:

"mod_auth",

And add this to the end of the file:

auth.backend = "plain"
auth.backend.plain.userfile = "/etc/lighttpd/passwd"
auth.require = ( "/backuppc/" => (
        "method" => "basic",
        "realm" => "BackupPC",
        "require" => "user=backuppc"
        )
)

Reload lighttpd config:

/etc/init.d/lighttpd reload

Now you'll be asked for username/password before entering /backuppc/ path.

vi /etc/lighttpd/passwd

Useful tools / links