Setting Up WordPress With An Azure VM

This guide will walk though setting up a WordPress site using an Azure VM. Some of the perks of doing this are:

Procedure

Step 1: Create An Azure VM

First, create an Azure VM with the following specs:

Once the VM is set, set the following Network Security Group rules:

Step 2: Set up LAMP Server

SSH into the server and install a LAMP server with the following:

After installation, verify correct installation:

Step 3: Configure MySQL

Run the following:

Do the following:

Run a query to allow access:

Edit the file /etc/mysql/mysql.conf.d/mysqld.cnf and comment out the bind-address line.

Restart MySQL:

Finally, test connecting to the database server using a tool like MySQL Workbench. When connected to the database server, do the following:

Step 4: Install WordPress

Download and unzip WordPress into /var/www/html:

Configure /etc/apache2/apache2.conf and allow AllowOverride to All in the /var/www directory.

Set the correct permissions for Apache:

As a final step, delete the index.html file from Apache:

You should now be able to run the WordPress installer and connect the database.

Once the WordPress Installer has run, log into the backend and check the site health to see if there are any misconfigurations within the system:

Optional Steps

Setting Up SSL With Let’s Encrypt

Before setting up SSL, you’ll need to set up a domain and set the appropriate DNS settings to be able to run the Let’s Encrypt process.

Enable SSL and restart Apache:

Run the commands provided by CertBot.

Enable Mail

The easiest way to enable mail is to use the WP Mail SMTP plugin. Once configured, you can use the plugin to set up alongside the email carrier of choice and test the submission functionality.

Increase Upload Size

To increase upload size (for things like uploading themes/plugins/media), edit the /etc/php/7.2/apache2/php.ini file:

Then restart Apache:

Restore from a Backup

If opted into backup when creating the VM, the VM will have an automatic daily backup progress that you can use to restore the VM at any point.

To restore a new VM, access the Recovery Vault and go to Backup Items -> Your VM Name -> Restore VM. Once you go this, you have two options: