Cherokee web
Home Up thttpd Web Server Cherokee web CRON+SSMTP Samba Velleman K8055 Perl Module GD in Perl Native

 

Cherokee web server

Warning this one got a bit complicated.

We start with ipkg install cherokee

However the server is not running at startup...

Adding a startup script

To make it run at startup there is one "proper" way and a few alternatives. The proper way is to place a special script in /etc/init.d and then enable the script using the command: update-rc.d

Here's the script I used, note it's almost certainly GPL code and I think I got it from the source "tarball". I've lost track of where it came from and I modified it to remove some options that busybox didn't support. 

This script appears to work well enough to start the server, however the "restart" and "reload-modules" functions are dodgy. I think the script needs to wait after stopping the service in order for the port 80 to become available again, otherwise it doesn't restart properly. 

The proper version of the script uses a retry option when shutting down the server to ensure that the server is stopped. I can't do that as the option isn't supported in busybox so I've bodged in a one second delay instead.

http://www.boristheengineer.co.uk/slug/download/cherokee

Hint: the easiest way to get that file onto the slug is probably:

wget http://www.boristheengineer.co.uk/slug/download/cherokee

root@zebidee:~# cd /etc/init.d
root@zebidee:/etc/init.d# wget http://www.boristheengineer.co.uk/slug/download/cherokee
Connecting to www.boristheengineer.co.uk[212.159.9.131]:80
cherokee             100% |*****************************|  1207       00:00 ETA

Once you have the script you can activate it with:

update-rc.d cherokee defaults 60

root@zebidee:/etc/init.d# update-rc.d cherokee defaults 60
Adding system startup for /etc/init.d/cherokee ...
/etc/rc2.d/S60cherokee -> ../init.d/cherokee
/etc/rc3.d/S60cherokee -> ../init.d/cherokee
/etc/rc4.d/S60cherokee -> ../init.d/cherokee
/etc/rc5.d/S60cherokee -> ../init.d/cherokee
/etc/rc0.d/K60cherokee -> ../init.d/cherokee
/etc/rc1.d/K60cherokee -> ../init.d/cherokee
/etc/rc6.d/K60cherokee -> ../init.d/cherokee

and if you want to remove it deactivate it with:

update-rc.d -f cherokee remove

root@zebidee:/etc/init.d# update-rc.d -f cherokee remove
update-rc.d: /etc/init.d/cherokee exists during rc.d purge (continuing)
Removing any system startup links for cherokee ...
/etc/rc0.d/K60cherokee
/etc/rc1.d/K60cherokee
/etc/rc2.d/S60cherokee
/etc/rc3.d/S60cherokee
/etc/rc4.d/S60cherokee
/etc/rc5.d/S60cherokee
/etc/rc6.d/K60cherokee

This should be enough to get you the default Cherokee home page.

Quick and dirty startup:

There is also a simpler way to get the server running if you have "cron" installed, you could add a line to the root crontab:

@reboot cherokee -b >/dev/null

Configuration

The configuration files are located in /etc/cherokee/

The one you are interested in is cherokee.conf

I left most of it alone but I changed the user and group settings so it ran as www-data

root@zebidee:~# cd /etc/cherokee
root@zebidee:/etc/cherokee# vi cherokee.conf
## Eg: User 65534
## Group 65534
##
User www-data
Group www-data

Running a web server as root is considered bad practice generally, though it may be convenient on a test system that's not going to be exposed to the internet.

By default the HTML files are located at /var/www/
and the CGI scripts are at /usr/lib/cgi-bin (which didn't exist, I had to create it:

root@zebidee:/# mkdir /usr/lib/cgi-bin

This behavior is set by a file in sites-available called "default". The convention is that each site you host has a file in sites-available and a link to it from sites-enabled.

 

Home Up thttpd Web Server Cherokee web CRON+SSMTP Samba Velleman K8055 Perl Module GD in Perl Native