This tutorial exists for these OS versions
- Ubuntu 22.04 (Jammy Jellyfish)
- Ubuntu 20.04 (Focal Fossa)
- Ubuntu 18.04 (Bionic Beaver)
- Ubuntu 16.04 (Xenial Xerus)
- Ubuntu 15.10 (Wily Werewolf)
- Ubuntu 14.04 LTS (Trusty Tahr)
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 [email protected] as well as [email protected], 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.