Using Lighttpd rather than Apache

From DAViCal Wiki

Jump to: navigation, search

Contents

Using Lighttpd rather than Apache

DAViCal works just fine using Lighttpd. Roll your own or get a leg up with Debian.

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

Installing DAViCal using apt-get on Debian will install Apache. Don't do that.

Debian can be used to install all the dependencies and DAViCal can be added by hand.

The tasks necessary are (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 dependencies using Debian; and (3) install DAViCal.

The downside of this self-install is hand installing DAViCal (and awl), which is easy but more fiddly than typing apt-get.

You can obtain DAViCal and awl (support utilities) from Sourceforge or Debian Squeeze. Once (1) and (2) are complete you need to copy DAViCal into your webspace (or make a symbolic link) along with installing awl (copying files) and making a symbolic link.

Once installed then the next steps are exactly the same as for 'apt-get davical' and 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:

sudo apt-get install lighttpd php5-cgi php5-common php5-xmlrpc php5-pgsql php5 libpcre3 postgresql-client-8.3 postgresql-8.3 libclass-data-inheritable-perl libclass-dbi-abstractsearch-perl libclass-dbi-perl libclass-dbi-pg-perl libclass-trigger-perl libclone-perl libdbd-anydata-perl libdbd-csv-perl libdbd-pg-perl libdbi-perl libdbix-contextualfetch-perl libima-dbi-perl liblingua-en-inflect-perl libnet-daemon-perl libplrpc-perl libsql-abstract-limit-perl libsql-abstract-perl libsql-statement-perl libsub-uplevel-perl libtest-exception-perl libtext-csv-xs-perl libuniversal-moniker-perl libxml-twig-perl libxml-xpathengine-perl libyaml-perl perl perl-base perl-modules

(3) You could download the Sourceforge sources but it is a little easier to use the Debian package. These instructions follow the Debian package route (but some remarks follow about installing direct from the source distributions):

  • Extract the DAViCal compressed files and copy them into the root file system:

$ ar x davical_0.9.6.2_all.deb data.tar.gz
$ tar zxf data.tar.gz
$ sudo cp usr /
$ sudo mkdir /etc/davical
$ sudo ln -s /usr/share/davical/htdocs/ /var/www/cal

-- Alternately, download the davical and awl sources (e.g. awl_0.36.tar.gz, davical_0.9.6.3.tar.gz), create directories /usr/share/davical directories and /usr/share/awl and copy from the davical tarball the dba, htdocs and inc into /usr/share/davical (e.g. cp -r inc /usr/share/davical) and from the tarball copy the dba and inc directories to /usr/share/awl.

and following Installation_Guide_Update set up symbolic links to awl for DAViCal:

$ cd /usr/share/davical/inc
$ sudo ln -s /usr/share/awl/inc/* .

-- Now DAViCal is setup with Lighttpd as it would be for Apache with apt-get install davical

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->domain_name = "calendar.example.net";
//  $c->sysabbr     = 'davical';
//  $c->admin_email = 'admin@example.net';
//  $c->system_name = "Really Simple CalDAV Store";

 $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).

Personal tools