Martin Knappe - 2014-10-07

This is just a quick guide to help you get started with my HTTPs server supporting my wwWidget Android app. For details on the app, please check out: https://play.google.com/store/apps/details?id=org.kohaerenzstiftung.wwwidget&hl=en

In order to install the server on your raspberry, first download the .deb file.
The package depends on a few other packages, so you first need to install those:

$ sudo apt-get install cutycapt libmicrohttpd10 imagemagick xvfb libglib2.0-0

Next, install the HTTP(s) server package itself:

$ sudo dpkg -i khttpd_0.80-1_armhf.deb

Next, create a file called httpd.conf, for example in your /root/ directory with the following content:

[main]
#Preforking server: enter here the minimum number of server processes
minHandlers=1
#Preforking server: enter here the maximum number of server processes
maxHandlers=5
#The port to listen on
port=8080
#The directory where the wwWidget plugin has been copied after package installation
pluginDirectory=/usr/lib/httpd/
#set to 'yes' for HTTPs support
secure=no

[wwwidget]
#the password used to authenticate (this is what you need to enter in your Android app later on)
password=secret

Save the file and try to start the server in the foreground:

$ sudo httpd -c /root/httpd.conf

Try to contact your server by entering URL and password in the Android app and fetch a screenshot.

For the server to run in daemon mode, a log directory must be specified. Create that directory:

$ sudo mkdir -p /var/log/khttpd

For the moment there really exists no log rotation in the server, so to prevent the server from filling up your precious disk space create the following symlinks:

$ ln -s /dev/null /var/log/khttpd/httpd.err
$ ln -s /dev/null /var/log/khttpd/httpd.out

You should now be able to run the server in daemon mode:

$ sudo httpd -d -l /var/log/khttpd/ -c /root/httpd.conf

If that works, simply add this last command to the end of your rc.local file in order to start the server automatically at boot time.

If you want to learn more about the server, look at the source code and/or drop me a line. Have fun!

PS: In order to run the server in HTTPs mode, the following would have to be changed:

1) In the httpd.conf file, set 'secure' to 'yes'
2) Specify the path to your CA's certificate:

caCertPath=path_to_your_CA's_certificate

3) Specify the path to your server's certificate:

serverCertPath=path_to_your_server's_certificate

4) Specify the path to your server's key file:

serverKeyPath=path_to_your_server's_key_file

 

Last edit: Martin Knappe 2014-10-08