Install Lighttpd web server, mysql 5.5 and PHP
Install Lighttpd web server on linux
I’ve wrote a few days back an article about the top web servers on the internet of 2013, Lighttpd was put in last place there, however it is not necessary the last one in the top if you’ve read my article, also there are other web servers out there that could do a better job then all 5. Anyway, Lighttpd was designed for security, speed, compliance, and flexibility, all in one little package. It has been used in the past to serve several big websites like wikipedia, youtube or meebo. The purpose of this web server was to provide:
- Faster FastCGI
- Asynchronous IO
The server is an event-driven architecture and is optimized for a large number of parallel connections (keep-alive) which is important for high performance AJAX applications.
In this article I’m going to show you how you can install this web server on linux Ubuntu / Debian operating system, there is no repository needed for Lighttpd so you just need to proceed and run the command:
1 |
apt-get install lighttpd |
When you load your local server IP or localhost http://localhost/ you should see a similar page:
Install Mysql server 5.5
To install the mysql server you need to run the below command, I’ve started using mysql 5.5 on all my servers, it does the job really well!
1 |
apt-get install mysql-client-5.5 mysql-server-5.5 |
This would install the mysql server and it will ask you for the root password. Enter it twice please and you should be finished.
Installing php and php extensions on Debian / Ubuntu
This part is similar to my other tutorials where you installed php on ubuntu / debian installations. You can check here how to install php, mysql and apache.
I will use the same repository / source list to install php 5, on debian which is Dotdeb. So you edit your source lists ( /etc/apt/sources.list ) and add there the line:
- for debian wheezy
1 2 |
deb http://packages.dotdeb.org wheezy all deb-src http://packages.dotdeb.org wheezy all |
- for debian squeeze
1 2 |
deb http://packages.dotdeb.org squeeze all deb-src http://packages.dotdeb.org squeeze all |
You will also need to fetch and install the GnuPG key:
1 2 |
wget http://www.dotdeb.org/dotdeb.gpg apt-key add dotdeb.gpg |
After this you can run the update command to update the apt package list:
1 |
apt-get update |
Next you can start the php installation and get everything up and ready.
1 |
apt-get install php5 php5-cgi php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-json |
This would get php5-cgi installed and you can link it to your fastcgi module in lighttpd.
Enable Fastcgi module on lighttpd
There is already a configuration available for you to use within the default installation of lighttpd, you just need to create a symbolic link to the conf-enabled folder like bellow:
1 2 |
ln -s /etc/lighttpd/conf-available/10-fastcgi.conf /etc/lighttpd/conf-enabled/10-fastcgi.conf ln -s /etc/lighttpd/conf-available/15-fastcgi-php.conf /etc/lighttpd/conf-enabled/15-fastcgi-php.conf |
Once this is completed, restart the lighttpd service and create a phpinfo() page to check if this is working.
1 |
/etc/init.d/lighttpd restart |
You should see a similar result when loading your phpinfo() page:
That’s about it, hope it helped you guys, and we will see you again in our next tutorial!