This guide applies to Ubuntu 16.04, I’ll cover other versions later.

1. Installing Nginx
First, let’s update the repos:

sudo apt-get update

Then install nginx:

sudo apt-get install nginx

Then check the nginx version with the following command:

nginx -v

If we get at least version 1.10.0, everything is fine.

2. Installing MySQL
The first step is to install the MySQL server:

sudo apt-get install mysql-server

Naturally, you need to fill in the root user’s password, which you’ll use to access MySQL later.
For PHP pages to run, you need to install PHP version 5 and its associated MySQL instruction set: