|This page is part of the 'build MineOS CRUX-from-the-ground-up series'. The information here is provided for comprehensiveness in documenting the steps in creating MineOS CRUX from CRUX Linux 2.7. These steps are already automated in the mainline release ISO.|
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:
cd /usr/ports/contrib/lighttpd pkgmk -d -i
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
groupadd lighttpd useradd -g lighttpd -M -s /sbin/nologin lighttpd
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
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 0.0.0.0:80 0.0.0.0:* LISTEN 8024/lighttpd
Auto-starting lighttpd on boot
- Edit the startup services config file: vi /etc/rc.conf
- Append lighttpd at the end of the start-up services list.
- Save and quit with :wq