How to Configure Basic Setup for lighttpd on CentOS 6.3

lighttpd is a secure, fast, compliant, and very flexible web-server that has been optimized for high-performance environments. It has a very low memory footprint compared to other webservers and takes care of cpu-load. This post will show you the basic lighttpd setup on CentOS 6.3. Refer to previous post to install lighttpd.

1. Configure basic lighttpd setup :

[root@centos63 ~]# vi /etc/lighttpd/lighttpd.conf
..
..
var.log_root    = "/var/log/lighttpd"
var.server_root = "/var/www"
var.state_dir   = "/var/run"
var.home_dir    = "/var/lib/lighttpd"
var.conf_dir    = "/etc/lighttpd"
..
..
server.port = 80
..
..
server.use-ipv6 = "disable"
..
..
server.document-root = server_root + "/lighttpd"
..
..
server.max-connections = 512

2. To check your lighttpd.conf for Syntax error, you can use this command, it can helps to find any misconfigurations easily:

[root@centos63 ~]# lighttpd -t -f /etc/lighttpd/lighttpd.conf
Syntax OK

3. Start lighttpd service :

[root@centos63 ~]# /etc/init.d/lighttpd start
Starting lighttpd:                                         [  OK  ]

4. Stop lighttpd service :

[root@centos63 ~]# /etc/init.d/lighttpd stop
Stopping lighttpd:                                         [  OK  ]

5. Create a HTML test page and access to it with web browser :

[root@centos63 ~]# vi /var/www/lighttpd/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Lighttpd Test Page
</div>
</body>
</html>

How to Install lighttpd with Fastcgi on CentOS 6.3

This post will cover the step to install lighttpd with Fastcgi on CentOS 6.3. lighttpd is a secure, fast, compliant, and very flexible web-server that has been optimized for high-performance environments. It has a very low memory footprint compared to other webservers and takes care of cpu-load. Its advanced feature-set (FastCGI, CGI, Auth, Output-Compression, URL-Rewriting and many more) make lighttpd the perfect webserver-software for every server that suffers load problems.

Run the following command to install using yum :

[root@centos63 ~]# yum install lighttpd lighttpd-fastcgi -y

Example :

[root@centos63 ~]# yum install lighttpd lighttpd-fastcgi -y
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: mirror1.ku.ac.th
 * epel: mirror.nus.edu.sg
 * extras: mirror.issp.co.th
 * updates: mirror1.ku.ac.th
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package lighttpd.i686 0:1.4.31-1.el6 will be installed
---> Package lighttpd-fastcgi.i686 0:1.4.31-1.el6 will be installed
--> Processing Dependency: spawn-fcgi for package: lighttpd-fastcgi-1.4.31-1.el6.i686
--> Running transaction check
---> Package spawn-fcgi.i686 0:1.6.3-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                       Arch              Version                    Repository         Size
====================================================================================================
Installing:
 lighttpd                      i686              1.4.31-1.el6               epel              296 k
 lighttpd-fastcgi              i686              1.4.31-1.el6               epel               45 k
Installing for dependencies:
 spawn-fcgi                    i686              1.6.3-1.el6                epel               16 k

Transaction Summary
====================================================================================================
Install       3 Package(s)

Total download size: 357 k
Installed size: 808 k
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 357 k
(1/3): lighttpd-1.4.31-1.el6.i686.rpm                                        | 296 kB     00:02
(2/3): lighttpd-fastcgi-1.4.31-1.el6.i686.rpm                                |  45 kB     00:00
(3/3): spawn-fcgi-1.6.3-1.el6.i686.rpm                                       |  16 kB     00:00
----------------------------------------------------------------------------------------------------
Total                                                               112 kB/s | 357 kB     00:03
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : lighttpd-1.4.31-1.el6.i686                                                       1/3
  Installing : spawn-fcgi-1.6.3-1.el6.i686                                                      2/3
  Installing : lighttpd-fastcgi-1.4.31-1.el6.i686                                               3/3
  Verifying  : lighttpd-fastcgi-1.4.31-1.el6.i686                                               1/3
  Verifying  : spawn-fcgi-1.6.3-1.el6.i686                                                      2/3
  Verifying  : lighttpd-1.4.31-1.el6.i686                                                       3/3

Installed:
  lighttpd.i686 0:1.4.31-1.el6                 lighttpd-fastcgi.i686 0:1.4.31-1.el6

Dependency Installed:
  spawn-fcgi.i686 0:1.6.3-1.el6

Complete!

To start lighttpd, run the following command :

[root@centos63 ~]# /etc/init.d/lighttpd start

To stop lighttpd, run the following command :

[root@centos63 ~]# /etc/init.d/lighttpd stop

How to Install and Configure Lighttpd on CentOS 6.2

The Lighttpd is an open-source web server more optimized for speed-critical environments than common products while remaining standards-compliant, secure and flexible. Lighttpd is an excellent tool for small to medium sized web sites. It is a web server for Linux/UNIX and Windows operating systems platform and is an alternative to Apache web server. In this post, i will show on how to setup Lighttpd on linux CentOS 6.2 server.

1. Install and configure PMforge Repository on CentOS 6.2 :
How to Add the RPMforge Repository on CentOS 6/RHEL 6 Linux Server

2. Install lighttpd using yum command :

[root@centos62 ~]# yum install lighttpd -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.ipserverone.com
 * extras: centos.ipserverone.com
 * rpmforge: ftp-stud.fht-esslingen.de
 * updates: centos.ipserverone.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package lighttpd.i686 0:1.4.28-2.el6.rf will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package               Arch              Version                        Repository             Size
====================================================================================================
Installing:
 lighttpd              i686              1.4.28-2.el6.rf                rpmforge              706 k

Transaction Summary
====================================================================================================
Install       1 Package(s)

Total download size: 706 k
Installed size: 2.6 M
Downloading Packages:
lighttpd-1.4.28-2.el6.rf.i686.rpm                                            | 706 kB     00:08
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : lighttpd-1.4.28-2.el6.rf.i686                                                    1/1

Installed:
  lighttpd.i686 0:1.4.28-2.el6.rf

Complete!

3. Configure Lighttpd starts automatically when boot up :

[root@centos62 ~]# chkconfig --levels 235 lighttpd on

or

[root@centos62 ~]# chkconfig lighttpd on

4. Open /etc/lighttpd/lighttpd.conf :

[root@centos62 ~]# vi /etc/lighttpd/lighttpd.conf

Make sure server.use-ipv6 is set to “disable” :

##
## Use IPv6?
##
server.use-ipv6 = "disable"

5. The server.document-root is located at /srv/www/lighttpd. Upload or create the following index.html to test your web server :

[root@centos62 ~]# vi /srv/www/lighttpd/index.html

Add this html code into index.html

<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Lighttpd Test Page on CentOS 6.2
</div>
</body>
</html>

6. Start lighttpd :

[root@centos62 ~]# /etc/init.d/lighttpd start
Starting lighttpd:                                         [  OK  ]

7. Browser your server ip address :
http:server_ip_address
Lighttpd