Lighttpd

Lighttpd is a highly-configurable, lightweight web server. See lighttpd and http://www.lighttpd.net/. There are many modules available for lighttpd that can be installed and configured. For more information on the modules see http://redmine.lighttpd.net/projects/lighttpd/wiki/docs.

Requirements

Execute

opkg list lighttpd*
to see what packages are available.

Installation

opkg

opkg update
opkg install lighttpd

Configuration

Edit /etc/lighttpd/lighttpd.conf

Basic Configuration

To get a basic server running make the following changes to /etc/lighttpd/lighttpd.conf:

Server Root Directory

server.document-root = "/www1/"

where www1 is the root directory of the web server.

Enable Logging

Uncomment (remove #) the following line so errors are written to the log:

server.errorlog = "/var/log/lighttpd/error.log"

Set Server Port

Uncomment the following line:

server.port = 8000

where 8000 is the port you want your webserver on.

Set Event Handler

I (jason955)had to set the event handler explicitly on my system, otherwise I would get the following error:

(server.c.1105) fdevent_init failed

To fix this problem I added the following line to my config file:

server.event-handler = "poll"

Info from http://redmine.lighttpd.net/projects/lighttpd/wiki/Server.event-handlerDetails

Advanced Configuration

Configure as a full LAMP stack

Configuring Lighttpd and PHP5

  1. First, follow php to install a version of PHP
  2. Second, follow lighttpd1 to configure lighttpd

Start on boot

To enable/disable start on boot:
/etc/init.d/lighttpd enable this simply creates a symlink: /etc/rc.d/S90umurmur → /etc/init.d/umurmur
/etc/init.d/lighttpd disable this removes the symlink again

To start the server one time: /etc/init.d/lighttpd start To stop the server again: /etc/init.d/lighttpd stop

Firewall

To allow users on the WAN to access the server, make sure to configure the firewall in /etc/config/firewall and port forwarding settings.

config redirect option src wan option src_dport 80 option dest lan option dest_ip 192.168.1.1 option dest_port 8000 option proto tcp config rule option src wan option dest_port 8000 option target ACCEPT option proto tcp

Restart the firewall with the following command: /etc/init.d/firewall restart

Administration

TODO: directory, etc.

Troubleshooting

Notes

none

Back to top

doc/howto/http.lighttpd.txt · Last modified: 2012/03/14 23:45 by pauldriver