The Perfect Web Server – Part 2

In the previous part of the Perfect Web Server, we went through some theory on LEMP server and configured an Nginx web server. In this part, we will set up a WordPress website after configuring a MySQL database.

Create a MySQL database

Here’s how to create a MySQL database and assign a user to it.

First, login to the MySQL server.

sudo mysql
  1. Create a database
  2. Create a user
  3. Assign the user full control over that database.
mysql> create database wpbeta;
mysql> CREATE USER 'wpbetauser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'iP3_iW2+qV0;rQ5$';
mysql> GRANT ALL ON wpbeta.* TO 'wpbetauser'@'localhost';
mysql> flush privileges;

Make sure to set a strong password of 15 characters, with uppercase, lowercase letters, numbers and symbols.

Take a note of the database credentials.

DB: wpbeta
DB USER: wpbetauser
DB PASS: iP3_iW2+qV0;rQ5$

Install WordPress

Download and extract the WordPress tar file. Set the correct permissions for the WordPress directories.

cd /var/www/
sudo wget https://wordpress.org/latest.tar.gz
sudo tar xvzf latest.tar.gz -C wpbeta/ --strip-components=1
sudo chown -R $USER:$USER wpbeta/
sudo chown -R $USER:www-data wpbeta/wp-content/
sudo chmod -R 775 wpbeta/wp-content/

Visit the website http://wpbeta.cloudpixels.in to run the WordPress installer and follow the instructions. Enter the database details.

Now, you have a working wordpress site. Enter your site name, user name and password and note it down.

Go to http://wpbeta.cloudpixels.in/wp-admin to login to your dashboard and edit your site further.

In the next part, we will see how to enable HTTPS, HTTP/2 and add a free Let’s Encrypt SSL certificate.

Leave a Reply