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. This article explains how to get lighttpd working on OpenWrt.
opkg list lighttpd*
to see what packages are available.
opkg update opkg install lighttpd
To get a basic server running make the following changes to
Server Root Directory
where www1 is the root directory of the web server.
Uncomment (remove #) the following line so errors are written to the log:
Set Server Port
Uncomment the following line:
where 8000 is the port you want your webserver on.
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:
To stop the server again:
To allow users on the WAN to access the server, make sure to configure the firewall in
/etc/config/firewall and port forwarding settings.
Restart the firewall with the following command:
Add virtual hosts via mod_simple_vhost
The goal is to run only one server on port 80. At the same time, this server should distinguish between different websites or directories. First, the Lighttpd server is configured as described. It must be ensured that the server works on port 80 (or any other port). In my example, the local domain suffix was specified with “h” (see dnsmasq configuration).
Now add the following entries to your file: /etc/config/dhcp
Add Module “mod_simple_vhost” to your: /etc/lighttpd/lighttpd.conf
Create virtual host Configuration: /etc/lighttpd/conf.d/IntraNet.conf
Restarted dnsmasq and lighttpd:
/etc/init.d/dnsmasq restart; /etc/init.d/lighttpd restart;
Via the address luci.h the configuration can now be called, and another website via home.h The IntraNet.conf can be extended with more virtual host names. Within virtual host you can configure host specific configurations.
You can also configure Internet Websites with this, like example.org or second.example.org
Make sure that the browser cache is deleted, often a new presence did not work because there is still some old information in the cache.
Incorrect Event Handler
If you get the following error:
(server.c.1105) fdevent_init failed,
you might need to set the event handler explicitly for your system. Add the following line to the configuration file:
.htaccessfiles as some web servers do to configure directory specific server settings. Instead, it uses a centrally configured system using
lighttpd.confto define all settings, using powerful matching functions. This still means that you have to manually set up directory settings. Especially for (opkg) packages that supply
.htaccessfiles to define required settings. Allowing directory listings is one example that should be disabled or enabled as per the required security level.