Lighttpd

From WebOS Internals
Revision as of 06:09, 31 July 2009 by Dimesacks (talk | contribs)
Jump to navigation Jump to search

Configuring the Lighttpd web server

Preliminaries

  1. Gain root access.
  2. Setup the Optware Feed.
  3. Open the root file system to read/write with rootfs_open.

Install Lighttpd with PHP support

ipkg-opt install lighttpd php-fcgi

Tweak settings

vi /opt/etc/lighttpd/lighttpd.conf

If you are going to run static HTML pages, there is no need to do this. If you want the ability to run PHP pages then this line must be uncommented:

                                "mod_fastcgi", 

You may also want to adjust the port that the web server runs on. Sprint blocks port 80 and this package installs Lighttpd to run on port 8081 :

## bind to port (default: 80)
server.port                = 8081

Start the web server:

/opt/etc/init.d/S80lighttpd start

Add files to the web directory:

The default home directory lives at:

/opt/share/www/

Sample gps.php file that will load your current location via Google maps:

<?php
$gps = `luna-send -n 2 palm://com.palm.location/startTracking '{"appId": "ILovePalm", "subscribe": true}' 2>&1 | tail -1 | cut -d, -f4,5 | sed -r 's/[^-\.0-9,]//g'`;
?>
<html>
<iframe width="600" height="500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/?ie=UTF8&q=<?php echo $gps ?>&z=16&ll=<?php echo $gps ?>&output=embed"></iframe><br /><small><a href="http://maps.google.com/?ie=UTF8&q=<?php echo $gps ?>&z=16&ll=<?php echo $gps ?>&source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>
</html>