Kunaljain's Weblog

July 31, 2007

Installing and Configuring Lighttpd

Filed under: Lighttpd — Kunal Jain @ 13:46

****Before installing the lighttpd web server you need to install some libraries****

*****For Debian Users*****

apt-get install pcre
apt-get install zlib
apt-get install pcre-devel

*****For CentOS Users*****

yum install pcre
yum install zlib
yum install pcre-devel

****Source code installation****

# cd /home/kunal/downloads/
(kunal is the name of the user, your system has different user name)

***Get latest source code*****

# wget http://lighttpd.net/downlaod/lighttpd-1.4.13.tar.gz

# cd /usr/local/src/

tar -zxvf /home/kunal/downloads/lighttpd-1.4.13.tar.gz

cd lighttpd-1.4.13

***Configuring lighttpd with ./configure

./configure --with-pcre --with-openssl

***Installing lighttpd***

 # make; make install;

***Create lighttpd user and group****

 # groupadd lighttpd

# useradd -g lighttpd -d /var/www/html -s /sbin/nologin lighttpd

****Create a log directory****

 # mkdir /var/log/lighttpd

# chown lighttpd:lighttpd /var/log/lighttpd

****create a configuration directory****

 # mkdir /etc/lighttpd
cp /usr/local/src/lighttpd1.4.13/docs/lighttpd.conf /etc/lighttpd/
chown lighttpd:lighttpd lighttpd.conf
cp /usr/local/src/lighttpd.1.4.13/docs/rc.lighttpd /etc/init.d/ ( redhat user copy rc.lighttpd.redhat )
cd /etc/init.d/
mv rc.lighttpd lighttpd
chown lighttpd:lighttpd lighttpd
chmod +x lighttpd

****configuring lighttpd.conf file****

 cd /etc/lighttpd/

vi lighttpd.conf

****Setup all the directives in lighttpd.conf file****

-> server.document-root = "/home/kunal/www/mysite.com/http" : Specifies default document-root for your server
-> server.port = 80 : Specifies http port for your server (default is 80)
-> server.username = "lighttpd"
-> server.groupname = "lighttpd"
-> server.bind = "server.ip-address" : Specify Server ip address. you can also specifies hostname
-> server.tag = "lighttpd"
-> server.errorlog = "/var/log/lighttpd/error.log" : Specifies the error log file
-> accesslog.filename = "/var/log/lighttpd/access.log" : Specifies the access log file name
-> index-file.names = ( "index.php", "index.html" )

****uncomment****

server.pid-file = “/var/run/lighttpd.pid”

****uncomment the follwing modules****
server.modules = (
“mod_access”,
“mod_accesslog”,
“mod_rewrite”,
“mod_auth”
)

****restarting lighttpd****

cd /etc/init.d/
./lighttpd restart

****verify that lighttpd is running or not.****
$ netstat -ntulp

Open your web browser and test the new set up by trying URL : http://your-site.com/ or http://server-ip/

Advertisements

1 Comment »

  1. Does this work for virtual directories?
    we tried the same there… , but it didn’t work out there…

    Comment by david — March 16, 2011 @ 07:05 | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: