Nginx is a free, open-source, high-performance HTTP server. Nginx is known for its stability, rich feature set, simple configuration, and low resource consumption. This tutorial shows how to install Nginx on an Ubuntu 11.10 with PHP5 support (through PHP-FPM) and MySQL support.
Installing MySQL 5:
First we will install the MySQL by issuing the following command.
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 .
Nginx is already available in the Ubuntu Package, so issue the following command to install Nginx.
Start the Nginx after the installation.
Test Your Nginx installation by opening your web browser and Navigate to http://192.168.0.10. You will get the following web page saying “Welcome to Nginx!“.
The default nginx document root on Ubuntu 11.10 is /usr/share/nginx/www. The configuration files are under /etc/nginx directory.
Next is to install PHP5 through PHP-FPM (PHP-FPM (FastCGI Process Manager), it is an alternative PHP FastCGI implementation. it has some additional features useful for sites of any size, especially busier sites). Install it by issuing the following command.
after the installation of PHP5 restart the Nginx server.
For testing the PHP, Place one PHP file on to the default directory of the nginx
Step 1. In the terminal copy/paste the following line:
This will open up a file called info.php.
Step 2. Copy/Paste this line into the info.php file:
Step 3. Save and close the file. use Esc + ;wq for saving the file.
Step 4. Now open you’re web browser and type the following into the web address:
The page look like below:
From the above screen shot , PHP5 is working, and it’s working through FPM/FastCGI, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP5. You will find that MySQL is not listed there which means we don’t have MySQL support in PHP5 yet. we need to install the MySQL support on PHP 5.
MySQL Support In PHP5:
To get the MySQL support in PHP5 we can install the php5-mysql package.
Once installed, restart the PHP-FPM.
Now refresh the Web browser that already you have opened for testing PHP.
You will find the MySQL modules list that are not listed before the installation of support package.