Using Lighttpd rather than Apache
From DAViCal Wiki
Contents |
Using Lighttpd rather than Apache
DAViCal works just fine using Lighttpd. Debian makes install easy.
Advantages
Lighttpd occupies a different, low resources, spot in the memory/cpu <-> facilities trade off. Owners of low memory/cpu systems, routers, ARM powered devices (e.g. nslu2) may prefer using Lighttpd rather than Apache as their web server.
DAViCal + postgres + lighttpd for personal use can squeeze into a 16Mb system and is very comfortable on a 32Mb system with no swap and 2Gb storage. Apple's Darwin Calendarserver does not fit into such systems.
Debian install
Summary
DAViCal in Debian is now web server agnostic.
(1) Install, setup and test Lighttpd with (fast)cgi PHP support -- this will not be covered here, there are plenty of other web resources for this relativity easy task;
(2) Install DAViCal with apt-get install davical. Make a symbolic link in your webspace to \usr\share\davical\htdocs
(3) Setup DAViCal, we follow the notes on this website Installation_Guide_Update, Installation_Guide_Update_(Feb_2008) and Installation_Experiences.
Install
(1) Lighttpd in Debian will by default create the webspace at /var/www.
(2) Below is a single line apt-get for Debian that will install all dependencies save Apache. Now DAViCal does not include Apache in its dependencies this is a simple line!
sudo apt-get install lighttpd davical
-- Now DAViCal is installed with Lighttpd and ready for setup.
Post install installation
In order to use DAViCal the postgres database needs to be created. The following brief dump of commands follows Installation_Guide_Update, Installation_Guide_Update_(Feb_2008) and Installation_Experiences.
$ sudo su postgres -c "createuser davical_app"
$ sudo su postgres -c "createuser davical_dba"
Now add lines:
local all all trust
local davical davical_dba trust
local davical davical_app trust
to the TOP of /etc/postgresql/8.X/main/pg_hba.conf" (and certainly before any other 'local' ones (otherwise you may get a 'FATAL: Ident authentication failed for user "davical_app"' error report).
Now create the DAViCal database:
$ sudo su postgres -c /usr/share/davical/dba/create-database.sh
You will see an output like :
Supported locales updated.
CalDAV functions updated.
RRULE functions updated.
Database permissions updated.
NOTE
====
- The password for the 'admin' user has been set to 'NOTE_PASSWORD_HERE'"
Thanks for trying DAViCal! Check in /usr/share/doc/davical/examples/ for
some configuration examples. For help, visit #davical on irc.oftc.net.
Note the password, you will use it to login as admin to set up user accounts in the web interface. Once the creation script has run correctly, go back to the pg_hba.conf file and remove the line:
local all all trust
Now we create the davical confid files:
$ cd /etc/davical/
Create the very simplest localhost-conf.php etc files -- check documentation for many more options:
<?php // $c->admin_email = 'admin@example.net'; // $c->system_name = "DAViCal CalDAV Server"; $c->pg_connect[] = 'dbname=davical user=davical_app';
For those who know, we intentionally left off the closing ?>.
Now make symbolic links (or, hey, just copy the file) for each hostname you use e.g. myhost.dynadns.org-conf.php, www.bought-ip-address.com-conf.php or just 192.168.0.1-conf.php
Note DAViCal uses the SERVER_NAME as supplied in the http request and forwarded to DAViCal by the cgi interface to pick a *-conf.php file. This means that if no server name is specified in the http:// request -- i.e. if accessing with an IP address like http://192.168.0.1/... -- then the conf file name will be -conf.php, quite awkward.
To avoid this make sure a default server name is specified in the /etc/lighttpd/lighttpd.conf, even if it is the IP address:
simple-vhost.server-root = "/var/www" simple-vhost.default-host = "192.168.0.1" simple-vhost.document-root = ""
You should be good to go now.
Access DAViCal at http://address/cal set up an user account which you can the use with you CalDav client at the address http://address/cal/caldav.php/user/home
More details at Installation_Guide_Update_(Feb_2008)#Using_DAViCal including what to do if you have lost you password.
Troubleshooting
Lighttpd logs errors in DAViCal scripts at /var/log/lighttpd/error.log
If you get logs like the following then don't worry, the SQ indiates the 'error' is actually a slow query warning which you should expect using a 32Mb 266MHz server.:
2009-04-11 10:44:27: (mod_fastcgi.c.2610) FastCGI-stderr: davical: LOG: calquery: Query: SQ: Error in '/usr/share/davical /inc/caldav-REPORT-calquery.php' on line 268
You may wish to change the time threshold for this error, in /usr/share/awl/inc/PgQuery.php change the line:
line 336: var $query_time_warning = 0.3;
to, say, 2.0 (seconds).

