Getting started

This article assumes you have at least a small amount of Linux knowledge and know how to enter basic commands into putty.

First of all your will need root access to your VPS or dedicated server with Debian 9 (stretch) installed. It is recommend you start with a clean copy of Debian 9 when following this guide. This guide assumes you have root access, therefore sudo is omitted. If you do not have root access, prefix each command with sudo.

What you will need:

Connect to your server using putty

Enter your IP address in the top field, leave the port default as 22 unless you have changed it and then press open. You will be prompted to enter your username and password. The username is normally root when you first configure your VPS.

Get up to date

We first need to make sure Debian 9 is fully up to date, run the following commands:

apt-get update
apt-get upgrade
apt-get install nano

Installing Nginx (mainline)

In this guide we will install the latest version of Nginx, the mainline version. Run the following commands in order:

Follow the installer through, you will need to enter a root password. Make sure it’s long, random and secure. You should also make note of this password as you’ll need it to login and configure MySQL. Do not make the password the same as your VPS login!

Congrats you have now installed MySQL

We need to configure nginx to be on the same user as PHP. Nginx is probably running as the user nginx currently, lets make it run as www-data which is the same user PHP will be running as to make things easier.

Run the following command:

nano /etc/nginx/nginx.conf

Navigate to the line user by using the arrow keys on your keyboard and delete nginx and replace it with www-data

Now Press ctrl+o then ctrl+x. This will save(write) and exit the file.

Run the following command:

service nginx restart

Setting up phpMyAdmin

This is a relative insecure setup of phpMyAdmin and I don’t recommend it for production use. You should protect your phpMyAdmin installation by whitelisting only you IP to access it and additionally have nginx basic authentication protecting it but for this guide we shall disregard this. But please beware that this is not very secure!

Have a go at logging in by visiting your IP address in the browser or whatever you put as the server_name variable. You will need to type root as the username and the MySQL root password you saved earlier (this is not your VPS password unless for some very insecure reason you put them the same).

Congratulations you have finished this guide!

If you spot any mistakes in this guide please let me know and I’ll fix them. This guide was mostly made from memory and some other guides on the internet.