There is a new version of this tutorial available for Ubuntu 16.04 (Xenial Xerus).
This tutorial exists for these OS versions
- Ubuntu 16.04 (Xenial Xerus)
- Ubuntu 15.10 (Wily Werewolf)
- Ubuntu 14.04 LTS (Trusty Tahr)
- Ubuntu 13.04 (Raring Ringtail)
- Ubuntu 12.10 (Quantal Quetzal)
- Ubuntu 12.04 LTS (Precise Pangolin)
On this page
Installing Nginx With PHP5 (And PHP-FPM) And MySQL Support On Ubuntu 10.10
Author: Falko Timme
Follow me on Twitter
Nginx (pronounced "engine x") 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 you can install Nginx on an Ubuntu 10.10 server with PHP5 support (through PHP-FPM) and MySQL support.
I do not issue any guarantee that this will work for you!
1 Preliminary Note
In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100. These settings might differ for you, so you have to replace them where appropriate.
I'm running all the steps in this tutorial with root privileges, so make sure you're logged in as root:
2 Installing MySQL 5.0
In order to install MySQL, we run
aptitude install mysql-server mysql-client
You will be asked to provide a password for the MySQL root user - this password is valid for the user root@localhost as well as firstname.lastname@example.org, so we don't have to specify a MySQL root password manually later on:
New password for the MySQL "root" user: <-- yourrootsqlpassword
Repeat password for the MySQL "root" user: <-- yourrootsqlpassword
3 Installing Nginx
Nginx is available as a package for Ubuntu 10.10 which we can install as follows:
aptitude install nginx
Start nginx afterwards:
Type in your web server's IP address or hostname into a browser (e.g. http://192.168.0.100), and you should see the following page:
You get a 403 forbidden error because on Ubuntu 10.10, the default nginx document root is /var/www, and there's no index page in /var/www. The nginx welcome page is located in /var/www/nginx-default (which was the default document root for nginx in previous Ubuntu versions), so you can see the welcome page by going to http://192.168.0.100/nginx-default/:
4 Installing PHP5
We can make PHP5 work in nginx through PHP-FPM (PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites) which we install as follows:
aptitude install php5-fpm
PHP-FPM is a daemon process (with the init script /etc/init.d/php5-fpm) that runs a FastCGI server on port 9000.