install lighttpd from source

From WebHostingNeeds.com
Jump to: navigation, search

Install Dependency

Install required files

yum -y install glib2-devel openssl-devel pcre-devel bzip2-devel gzip-devel
yum -y install gamin
yum -y install gamin-devel
yum -y install gcc gcc-c++

Install Lighttpd

Go to http://www.lighttpd.net, download latest lighttpd.

At the time of writing, 1.4.32 is latest lighttpd

cd /usr/local/src
wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.33.tar.gz
tar -zxvf lighttpd-1.4.33.tar.gz
cd lighttpd-1.4.33
make clean && make distclean
./configure --with-fam
make
make install

Configure lighttpd

sed -e 's/FOO/lighttpd/g' doc/initscripts/rc.lighttpd.redhat > /etc/init.d/lighttpd
chmod 755 /etc/init.d/lighttpd
echo "LIGHTTPD_CONF_PATH=/etc/lighttpd/lighttpd.conf" > /etc/sysconfig/lighttpd
install -Dp ./doc/config/lighttpd.conf /etc/lighttpd/lighttpd.conf
cp -R doc/config/conf.d/ /etc/lighttpd/
cp doc/config/conf.d/mod.template /etc/lighttpd/modules.conf
chkconfig lighttpd on

Create sym link

ln -s /usr/local/sbin/lighttpd /usr/sbin/lighttpd


Create user and group for lighttpd

groupadd lighttpd
adduser -m -g lighttpd -d /var/www -s /sbin/nologin lighttpd

Create log folder for lighttpd and set ownership

mkdir /var/log/lighttpd
chown lighttpd:lighttpd /var/log/lighttpd


vi /etc/lighttpd/modules.conf

Add required modules.

vi /etc/lighttpd/lighttpd.conf



service lighttpd start


Set document root folder

server.document-root        = "/srv/www/htdocs/"

Set username and group.

perl -i -p -e 's/#server.username            = "wwwrun"/server.username            = "lighttpd"/g;' /etc/lighttpd/lighttpd.conf
perl -i -p -e 's/#server.groupname           = "wwwrun"/server.groupname           = "lighttpd"/g;' /etc/lighttpd/lighttpd.conf

Set pid file

server.pid-file            = "/var/run/lighttpd.pid"


Find

server.use-ipv6 = "enable"

Replace with

server.use-ipv6 = "disable"



lighttpd