Install lighttpd web server HOWTO

From GreenphoneWiki

Jump to: navigation, search

Contents

[edit] How to install a web server on the GreenPhone

[edit] Introduction

These are the steps I've used to build the lighttpd web server for the GreenPhone. Once you've got it running then it should be possible to get to files on the phone whilst it's connected via USB by pointing your browser at http://10.10.10.20/

[edit] Todo

  1. Add instructions on how to build it for the emulator

[edit] Sample config file

There's a very basic config file available to use at http://www.mcqn.net/projects/Greenphone/basic.lighttpd.conf It assumes that the log files live in /var/log/lighttpd and the server root is at /mnt/disk2/htdocs. It also provides a directory alias so http://greenphone/documents/ shows the contents of /mnt/user_local/ and so allows you access to the user's documents.

[edit] Building and installing lighttpd

1. Download the latest source from http://www.lighttpd.net/download to a suitable location where you can build it, e.g. /devel

2. Extract the source

cd /devel
tar zxf lighttpd-<version>.tar.gz

3. Configure it to build for greenphone

cd lighttpd-<version>
source /opt/Qtopia/SDK/scripts/devel-greenphone.sh
./configure --host=arm-linux --prefix=/mnt/disk2 CC=/usr/local/arm-linux/bin/arm-linux-gcc CFLAGS=-lpthread CXX=/usr/local/arm-linux/bin/arm-linux-g++ CXXFLAGS=-lpthread

If you want to install lighttpd somewhere other than /mnt/disk2 then change the --prefix parameter in the configure line above

4. Build the software. These instructions assume you don't have anything in /mnt/disk2. (You might need to change the permissions for /mnt/disk2 in order to run make install successfully)

make
make install

5. Prepare the software for installation. This only shows copying the config file to the right place, you'll need to edit it to configure it correctly (probably at least changing the server root). If you set the server root to somewhere in /mnt/disk2 (e.g. /mnt/disk2/htdocs) then you might want to copy some HTML files into the relevant place in the server root directory now too.

mkdir /mnt/disk2/etc
mkdir /mnt/disk2/etc/lighttpd
cp doc/lighttpd.conf /mnt/disk2/etc/lighttpd

6. tar the files up to make it easy to copy them to the phone. If you want the tar file to be somewhere other than /devel/lighttpd.tar then change that paramter.

cd /mnt/disk2
tar -cz --owner=0 --group=0 -f /devel/lighttpd.tar.gz *

7. Copy the tar file over to the phone using Konqueror, from /devel/lighttpd.tar.gz to smb://10.10.10.20/documents

8. ssh into the phone (using gph -console) and run the final steps of the installation

cd /mnt/disk2
tar zxvf /mnt/user_local/lighttpd.tar.gz

9. Start the web server. From ssh on the greenphone...

mkdir /var/log/lighttpd
/mnt/disk2/sbin/lighttpd -f /mnt/disk2/etc/lighttpd/lighttpd.conf

10. Automate startup/shutdown. Add the lines from step 9 to the file /mnt/user/etc/trolltech_startup.sh and add the line killall lighttpd to /mnt/user/tools/shutdown

Personal tools