How to Install Lighttpd with Iredmail

How to Install Lighttpd with Iredmail

Lately, I have been trying different web servers with the following Goals in Mind.

The response should be fast (as in resolve quick in a 2G network or a score of 90 n above in page speed)

Should be resource friendly, utilize less memory as possible.

With these two Goals in mind I have been experimenting with Nginx and Lighttpd .

how to install lighttpd with iRedmail

how to install lighttpd with iRedmaill

I decided to try Lighttpd, partly because it is recommended by roundcube., and nginx you can only install modules at compile time.

In order to Install lighttpd on iRedMAil you need to have the epel repo

rpm -Uvh

yum -y install lighthttpd lighhttpd-fastcgi php-fpm

This post assumes that you have iRedmail installed, if not then please install it first

It is less than 1MB and has no dependencies

open the config file

vim /etc/lighttpd/lighttpd.conf

Check the following directives and either add or change them as follows

var.server_root = "/var/www"
server.use-ipv6 = "disable"
include "modules.conf"
include_shell "cat /etc/lighttpd/vhosts.d/*.conf"
include "conf.d/fastcgi.conf"

Next goto the vhost directory and setup your site conf file

cd /etc/lighttpd/vhosts.d/

$HTTP["host"] == “” {
var.server_name = “” = server_name

server.document-root = “/var/www/roundcubemail/”
## use a seperate access log file
## At the moment you cant have different error log files.
accesslog.filename = “/var/log/lighttpd/”

$SERVER["socket"] == “:443″ { = “mail.yoursite.conf”
ssl.pemfile = “/etc/lighttpd/ssl/”
ssl.engine = “enable”

server.document-root = “/var/www/roundcubemail/”
You need to add your private key and certificate in one file called pem.

The iredmail ssl keys and cet are in the follow directries

cat iRedMail.key iRedMail_CA.pem > yoursite.pem

The sequence is not important.

create a ssl folder

cd /etc/lighttpd/
mkdir -p ssl/
mv yoursite.pem /etc/lighttpd/ssl/
chown -R lighttpd:lighttpd ssl

FastCGI module and config

You can configure modules in modules.conf in /etc/lighttpd/modules.conf, uncommet the module in server.modules parameter

But fastcgi it is better to use a separate file in conf.d directory

vim /etc/lighttpd/conf.d/fastcgi.conf


server.modules += ( “mod_fastcgi” )
fastcgi.server = ( “php-local” =>
“host” => “″,
“port” => “9000″,

“broken-scriptfilename” => “enable”,

That’s it, now start php-fpm and lighttpd
service php-fpm start
service lighttpd start

If you get the below error then disable seliniux

root@testserver /]# /etc/init.d/lighttpd start
Starting lighttpd: 2011-07-30 06:52:41: (server.c.722) couldn't set 'max filedescriptors' Permission denied

Disable selinux in

vim /etc/selinux

If you have any issues disable iptables n check.ta

I have at





Follow me

Leo G

Is a Lead(Devops), linux/python/bash enthusiast and hobbyist, coffeeand beer lover. He shares his knowledge via this blog so he can learn something new from you. He would love if you forked him on Github
Follow me

Similar Posts
What is a DMARC record and how to add it
Lately, I have been trying different web servers with the following Goals in Mind. The response should be fast (as...