How to Install Lighttpd With PHP5 And MySQL On Ubuntu 11.04
Lighttpd is an open-source web server more optimized for speed-critical environments than common products while remaining standards-compliant, secure and flexible.
Here i will explain you the installation of Lighttd with PHP and MySQL on Ubuntu 11.04. In this tutorial i have used hostname as server1.example.com with the IP address 192.168.0.10.
The first thing you need to do is to login as root. You can login as root in Ubuntu Linux by typing in the terminal:
Installing MySQL 5:
First we will start the installation of MySQL.
You will be asked to provide a password for MySQL user “root“. The same password will be valid for the user root@localhost as well as firstname.lastname@example.org .
Next is to install lighttpd. By default lighttpd is available in Ubuntu package. To install type the following command and Press Enter.
Start lighttpd by issuing the command.
Navigate your browser to http://192.168.0.10/index.lighttpd.html, and you should see the Lighttpd Placeholder page.
The default document root is /var/www/ on Ubuntu, and the configuration file is /etc/lighttpd/lighttpd.conf. Additional configurations are stored in files which are situated in the/etc/lighttpd/conf-available/ directory.
Next is to install PHP 5 on Ubuntu with FastCGI. Ubuntu provides a FastCGI-enabled PHP5 package. We can install by issuing the following command.
Configuring Lighttpd and PHP 5:
To enable PHP5 in Lighttpd, you will have to modify the configuration file /etc/php5/cgi/php.ini and uncomment the line cgi.fix_pathinfo=1:
To enable the FastCGI configuration (which is stored in /etc/lighttpd/conf-available/10-fastcgi.conf), run the following command:
To reload the server for changes to take place, type in the terminal:
For testing the PHP, Place one PHP file on to the default directory of the Apache.
In the terminal copy/paste the following line:
This will open up a file called phpinfo.php.
Copy/Paste this line into the info file:
Save and close the file. use Esc + ;wq for saving the file.
Now open you’re web browser and type the following into the web address:
The page look like below:
As you see in the screenshot, PHP5 is working fine, and it is working through FastCGI, as shown in theServer API line. If you scroll further down, you will see all modules that are already enabled in PHP5. Now your web server is ready for working.