From MineOS
Jump to: navigation, search

Lighttpd (pronounced 'lightly') is a light-weight webserver. From the lighttpd website,

Security, speed, compliance, and flexibility -- all of these describe lighttpd (pron. lighty) which is rapidly redefining efficiency of a webserver; as it is designed and optimized for high performance environments. With a small memory footprint compared to other web-servers, effective management of the cpu-load, and advanced feature set, lighttpd is the perfect solution for every server that is suffering load problems.



All included in CRUX install.

Installing from ports

lighttpd can be installed from ports, but from the user-submitted repository 'contrib', which is not accessible by default, since it is not an official CRUX production. The 'contrib' repository is well managed, however, so we can enable it. The full instructions are listed in the CRUX Handbook.

Complete step 5.2.5 and then type the following commands:

Configuring lighttpd


Adjust the configuration file to match your preferences, namely the port, username, groupname, and filepaths. For simplicity sake, comment out the error_log and access_log. These can be re-enabled later.

server.port = 80
server.username = "lighttpd"
server.groupname = "lighttpd"
# chrooted operation
server.chroot = "/var/www"
server.document-root = "/htdocs"
#server.errorlog = "/var/log/error_log"
#accesslog.filename = "/var/log/access_log"

Creating lighttpd's user and group

Understanding the command

useradd -g groupname -M -s loginshell username

useradd - program that creates a new user
-g groupname - auto-adds user to existing groupname
-M - do not create home directory for user
-s loginshell - login shell for user
username - the username to create

Starting lighttpd

Start the lighttpd server daemon:

# lighttpd -f /etc/lighttpd.conf
 2011-06-13 05:59:50: (log.c.166) server started

Verify the server is accessible with Netstat:

# netstat -ntulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0    *               LISTEN      8024/lighttpd

Auto-starting lighttpd on boot

  1. Edit the startup services config file: vi /etc/rc.conf
  2. Append lighttpd at the end of the start-up services list.
  3. Save and quit with :wq
Adjusted /etc/rc.conf