LLMP is a better LAMP . It is fast and stable. Lighty+php is 25% faster than Apache+mod_php . An LLMP server will provide 2 to 3 times faster than a LAMP. Lighttpd webserver is under BSD license so that you can configure it as you wish.
“Light is life,Lighty is Light,…..fly light”
1.1 What is Lighttpd?
Lighttpd ( Lighty or LightTPD) is a light weight webserver. It is faster than other webservers (like apache ,etc.,). So Lighty is very useful in high traffic servers.
1. Introduction
1.1 What is Lighttpd?
1.2. Features of Lighttpd.
2. What is LLMP (Linux + Lighttpd + Mysql +Php)
3. Install Lighttpd
3.1 Install open-ssl
4. Install Mysql
4.1 Using RPM
4.2 Using Source
5. Install Php
6. Conclusion
A. Acknowledgment
B. Downloads
C. References
D. Author
1.2. Features of Lighttpd
- Modules support
- Cache Meta Language
- Virtual hosting
- Minimal WebDAV support
- Servlet (AJP) support (in versions 1.5.x and up)
- Rule-based downloading
- Server-side includes support
- rrdtool statistics
- chroot support
- select()-/poll()-based web server
- Authentication against a LDAP server
- SSL support
- Support for more efficient event notification schemes like kqueue and epoll
- Conditional rewrites
- Load-balancing FastCGI and SCGI support
- lighttpd runs on GNU/Linux and other Unix-like operating systems and Microsoft Windows (with and without Cygwin).
- Ruby on Rails and Lua communities.
- Perl,Python,etc support
- Secure
- Speed
- Compliance
- Flexibility
- Small memory footprint
- Effective management of the cpu-load
- Event-driven architecture supports for high performant AJAX applications
2. What is LLMP (Linux + Lighttpd + Mysql +Php)
LLMP ( Linux + Lighttpd +Mysql+PHP) is both a development and service environment same as LAMP(Linux +Apache+ Mysql+PHP) but with more performance and advantages than LAMP. Its configuration is very simple and can be used in live servers and local development environments.
From the following sections you can setup a general LLMP without much difficulty.
So let us start it now….
3. Install Lighttpd
In this section you can install and configure Lighty
# cd /usr/src/# wget http://www.lighttpd.net/assets/2007/1/29/lighttpd-1.4.13.tar.gz# tar -xvzf lighttpd-1.4.13.tar.gz# cd lighttpd-1.4.13/# ./configure --prefix=/usr/local/lighttpd --enable-fastcgi --with-openssl# make# make install# mkdir /etc/lighttpd# cp -fr doc/lighttpd.conf /etc/lighttpd/
Now let us edit the configuration file of lighty ” /etc/lighttpd/lighttpd.conf “
# pico /etc/lighttpd/lighttpd.conf
Add the following configurations.
server.modules ( "mod_rewrite", "mod_auth", "mod_access", "mod_accesslog" )server.document-root = "/var/www/html/"server.errorlog = "/var/log/lighttpd.error.log"accesslog.filename = "/var/log/lighttpd.access.log"server.port = 80server.bind = "192.168.1.201"server.pid-file = "/var/run/lighttpd.pid"server.username = "lighttpd"server.groupname = "lighttpd"
Here the ip “192.168.1.201” is my local ip ,so please change “server.bind” to your local ip and “server.port” to the port in which you wish to run lighty.
Now let us add a user to run lighty
# useradd lighthttpd# groupadd lighthttpd
Now create the log files
# touch /var/log/lighttpd.error.log# touch /var/log/lighttpd.access.log
Now change the ownerships
# chown lighthttpd.root /etc/lighttpd/lighttpd.conf# chown -R lighttpd.lighttpd /var/www/html/# chown lighttpd.lighttpd /var/log/lighttpd.error.log# chown lighttpd.lighttpd /var/log/lighttpd.access.log
Now create our startup deamon script
# pico /etc/init.d/lighttpd
Add the following lines to this script
#!/bin/sh# Source function library. /etc/rc.d/init.d/functionsif [ -f /etc/sysconfig/lighttpd ]; then . /etc/sysconfig/lighttpdfiif [ -z "$LIGHTTPD_CONF_PATH" ]; then LIGHTTPD_CONF_PATH="/etc/lighttpd/lighttpd.conf"fiprog="lighttpd"lighttpd="/usr/local/lighttpd/sbin/lighttpd"RETVAL=0start() { echo -n $"Starting $prog: " daemon $lighttpd -f $LIGHTTPD_CONF_PATH RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog return $RETVAL}stop() { echo -n $"Stopping $prog: " killproc $lighttpd RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog return $RETVAL}reload() { echo -n $"Reloading $prog: " killproc $lighttpd -HUP RETVAL=$? echo return $RETVAL}case "$1" in start) start ;; stop) stop ;; restart) stop start ;; condrestart) if [ -f /var/lock/subsys/$prog ]; then stop start fi ;; reload) reload ;; status) status $lighttpd RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}" RETVAL=1esacexit $RETVAL########################################### Now give execute permission to this daemon script
# chmod 755 /etc/init.d/lighttpd
Let us start our Lighty as follows,before that all webservers listening to the port(server.port) must be stopped
# /etc/init.d/lighttpd start
Our Lighty is started and let us check it is listening port 80( or port mentioned in server.port).
# netstat -pant |grep lighttpd
Now we can create a test html file in the document-root.
# pico /var/www/html/index.html
Add the following lines to index.html.
Lighttpd is running......
Then call this file through the browser (with your Ip as configured in server.bind)as follows
http://192.168.1.201/
Note: If you use port other than 80 ,then you may need to mension that port in browser as http://192.168.1.201:port/
WOW lighty is working ..!!!
Let us add the following line to rc.local such that our server will be started during the boot time.
# echo "/etc/init.d/lighttpd start" >> /etc/rc.d/rc.local
The section ” 3.1 “ is for just a fun you can avoid this portion and continue with section ” 4 “
The following steps ( in section 3.1 )will help you to install a self signed SSL certificate for your domain
3.1 Install open-ssl
Let us install an ssl for your domain as follows.
# mkdir /etc/lighttpd/ssl/yourdomain.com -p# cd /etc/lighttpd/ssl/yourdomain.com
Now create SSl as follows. You need to provide information such as country name, your domain name etc.,
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
Let us give ownerships and permissions.
# chown lighttpd:lighttpd /etc/lighttpd/ssl -R# chmod 0600 /etc/lighttpd/ssl/yourdomain.com
Now edit the lighty configuration to add ssl informations.
# pico /etc/lighttpd/lighttpd.conf
Add the following lines
$SERVER[