Lighttpd

From MineOS Wiki
Revision as of 10:00, 28 October 2011 by Hexparrot (talk | contribs) (→‎Installing from ports)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to 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.

Dependencies

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

lighttpd.conf


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.

<syntaxhighlight>

server.port = 80 server.username = "lighttpd" server.groupname = "lighttpd"

  1. chrooted operation

server.chroot = "/var/www" server.document-root = "/htdocs"

  1. server.errorlog = "/var/log/error_log"
  2. accesslog.filename = "/var/log/access_log"

</syntaxhighlight>

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: <syntaxhighlight>

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

</syntaxhighlight> Verify the server is accessible with Netstat:

<syntaxhighlight>
  1. 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 </syntaxhighlight>

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