Installing Nginx with PHP 7 and MySQL 5.7 (LEMP) on Ubuntu 16.04 LTS This tutorial exists for these OS versions
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
1 Preliminary Note
2 Installing MySQL 5.7
3 Installing Nginx
4 Installing PHP 7
5 Configuring nginx
6 Getting MySQL Support In PHP 7
7 Making PHP-FPM use a TCP Connection
8 Links
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 16.04 server with PHP 7 support (through PHP-FPM) and MySQL 5.7 support (LEMP = Linux + nginx (pronounced "engine x") + MySQL + PHP). 1 Preliminary Note
In this tutorial, I use the hostname server1.example.com with the IP address192.168.1.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:
sudo -s
2 Installing MySQL 5.7
In order to install MySQL, we run:
apt-get -y 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 root@server1.example.com, so we don't have to specify a MySQL root password manually later on:
New password for the MySQL "root" user: