How to Set Up a WordPress Blog in Microsoft Azure

choubertsprojects

VPN offers!

1. NordVPN

2. Surfshark

3. ExpressVPN

Microsoft Azure is a cloud computing service created by Microsoft. It enables users to store, manage and run their applications in the cloud rather than on-site or in local servers.

How to Set Up a WordPress Blog in Microsoft Azure

WordPress is the most widely used blogging platform, and there are several methods to create a WordPress site. If you have Azure credits or your company utilizes Azure for other services, it’s a no-brainer to use Azure for WordPress.

You’ll learn how to create an Azure WordPress instance from scratch in this article. You’ll learn how to use Azure Database for MySQL and Azure Web Apps to easily set up a WordPress blog.

Why use Azure to host WordPress?

A WordPress blog may be set up in a variety of ways. Its open-source nature provides a plethora of possibilities.

Many users prefer to install WordPress on a real or virtual server using the LAMP stack (Linux, Apache, MySQL, and PHP). But instead of Web Apps and managed MySQL, why not utilize a virtual machine with that pre-installed set of software? That’s what Azure allows you to accomplish.

You must manage your own LAMP stack for performance and security, which includes patching and monitoring. This upkeep frees you up to focus on the more vital task of administering your site!

Maintenance chores are offloaded to Azure Web Apps and the Azure managed MySQL product when you set up WordPress on Azure. After that, you’ve effectively eliminated an entire employment role: server administrator. This frees up a website owner’s time to concentrate on the site rather than all of the hosting responsibilities.

How to Create a Ghost Blog on Azure

Prerequisites

Please make sure you have the following requirements if you want to follow along with this tutorial:

  • A Microsoft Azure account
  • A MySQL database creation tool. HeidiSQL will be used in this tutorial.

It’s worth noting that setting up resources in your Azure subscription may incur a minor Azure use cost. Remember to delete the materials you generate in this lesson if you don’t want to retain them!

Creating a MySQL Instance

Database management and optimization is a demanding process. A website owner will often need to devote a significant amount of effort to ensuring that the backend database is operational and accessible. With Azure, no way!

These chores are made easier by Azure’s managed MySQL service. You’ll learn how to set up a managed MySQL instance, establish a MySQL database, and configure the instance to work with WordPress in this section.

Setting up the MySQL Server

The database must be created initially. To do so, first:

  1. Within the Azure Portal, go to the Azure Database for MySQL servers area and select Create Azure Database for MySQL server.

To launch a managed MySQL instance, go to the Azure Portal area.To launch a managed MySQL instance, go to the Azure Portal area.

2. After that, a form appears where you can fill out the essential information to supply the instance. Use the values shown below.

  • The MySQL database and the Web App will both be contained in the specified resource group.
  • Server Name: Give the MySQL instance a name that reflects the environment and the function of the instance.
  • Location: If your server is close to where the bulk of your website’s traffic comes from, it will boost performance.
  • Version: In this post, we’ll use MySQL 8.0 since it’s the most recent version accessible.

Entering the MySQL instance's provisioning informationEntering the MySQL instance’s provisioning information

3. Select the Compute + Storage size next. Choose the Basic tier with a single core for this instruction. If you’re putting this in production, be sure to do some performance tests to make sure you’ve allocated enough power.

Choosing the MySQL instance's price tierChoosing the MySQL instance’s price tier

You may construct MySql databases that are read replicas. These databases may be used to scale reads and load over several computers. Choose a size from the General Purpose and Memory Optimized choices if you want to add a read replica. Although these databases are more costly, they provide more choices and performance.

4. Create an administrator account (which serves as MySQL’s root user) and a password that is sufficiently complicated.

Entering the MySQL instance's administrator username and passwordEntering the MySQL instance’s administrator username and password

5. While the Tagging page allows you to tag Azure resources, this step is not required for the lesson. Tagging allows you to add more information to an Azure resource.

The MySQL instance's tagging sectionThe MySQL instance’s tagging section

6. Finally, click Create to begin the process of setting up the managed MySQL instance.

Reviewing the settings and launching the MySQL serverReviewing the settings and launching the MySQL server

Allowing Required Traffic to Pass Through the Firewall

Every Azure MySQL server instance comes with a firewall by default. Outside of Azure, this firewall prohibits all client IPs from connecting to it. To guarantee that you may manage databases on the server instance, you must add your current client IP address to the Allow list (at the very least).

  1. Select MySQLinstance from the resources list while remaining on the MySql instance screen, and then go to the Connection security section.
  2. Select Add current client IP address from the drop-down menu. This step adds the IP address from which you’re presently accessing the Azure Portal.

Make sure your client IP address is included so a third-party MySQL client may connect and build the database. If you’re performing this from a different client’s location, be sure to use that cheval cheval’s IP instead.

Through the MySQL firewall, the client IP address is allowed.Through the MySQL firewall, the client IP address is allowed.

2. Next, make sure Allow access to Azure Services is enabled. This option enables the web app you’ll build later to interface with the managed MySQL instance.

Using the MySQL firewall to allow Azure ServicesUsing the MySQL firewall to allow Azure Services

3. Save your changes and you’re finished!

MySQL Database Creation

After you’ve built the MySQL server instance, you’ll need to connect to it in order to build the WordPress database.

Navigate to the Connection strings section on the MySQL server instance page you just created. Take note of the ADO.NET connection string, which is shown below. Copy the FQDN server name as well as the Uid from the connection string.

Obtaining the right values from the MySQL instance's Connection Strings screenObtaining the right values from the MySQL instance’s Connection Strings screen

Now it’s time to build the database. There are several methods to establish a MySQL database, but we’ll use HeidiSQL, a Windows tool for managing MySQL databases, for this lesson.

  1. Create a new connection using HeidiSQL.
  2. Use the server FQDN acquired here for the Hostname / IP field and the UID from above for the User field on the connection page. The password will be the same as when the instance was provisioned.

Using the HeidiSQL program to enter the connection informationUsing the HeidiSQL program to enter the connection information

3. Next, go to the Advanced section and tick Use SSL, leaving the rest of the settings alone. For an Azure managed MySQL instance, SSL is enabled by default.

Checking the HeidiSQL connection information for Use SSL.Checking the HeidiSQL connection information for Use SSL.

4. Select the Open option. HeidiSQL should now display all default databases generated when a new MySQL server is started.

When connecting to the MySQL instance in HeidiSQL, make sure the right default databases appear.When connecting to the MySQL instance in HeidiSQL, make sure the right default databases appear.

5. Right-click on the server (in this case, Unnamed) and choose Create new Database.

Creating a new HeidiSQL databaseCreating a new HeidiSQL database

6. Type in wordpress and choose utf8mb4 unicode ci as the Collation. For WordPress databases, this is the suggested default collation.

HeidiSQL is used to create the required WordPress database.HeidiSQL is used to create the required WordPress database.

If the process was successful, a new WordPress database will appear in the list.If the process was successful, a new WordPress database will appear in the list.

You may also use the MySQL client to establish a blank database by typing CREATE DATABASE wordpress;.

Developing an Azure Web App

Microsoft Azure web applications provide an application experience that requires far less maintenance than a standard hosting environment. You will utilize a container-based method (Docker) for this lesson.

In the Azure portal, go to:

  1. Go to the area called Azure Web Sites.
  2. To supply the instance below, click Create Web App and fill in the relevant data.
  • Use the same resource group that was previously used to store the Managed MySQL instance.
  • Name: Give your web application a descriptive name that is easy to remember.
  • Docker Container: Publish
  • To ensure that geographical distance does not hamper performance, use the same area that the Managed MySQL instance was deployed in.

Developing an Azure Web AppDeveloping an Azure Web App

2. Select the right SKU for the App Service Plan. The S1 Production instance will be used in this article.

Selecting the Azure Web App price tierSelecting the Azure Web App price tier

3. Select the following WordPress docker container to utilize as the foundation for our web project after clicking Next: Docker.

  • Docker Hub provided the image.
  • Type of Access: Public
  • WordPress image and tag

For the Azure Web App, provide the relevant Docker container information.For the Azure Web App, provide the relevant Docker container information.

4. Because Application Insights are not accessible in this Web App due to the precise mix of options chosen, we may move on to Tags.

This application does not have Application Insights accessible.This application does not have Application Insights accessible.

5. This tutorial, like the Managed MySQL instance, chooses not to utilize tags for these resources.

This Web App instance will not have any further tags.This Web App instance will not have any further tags.

6. Finally, click Create to Provision the Web App to instruct Azure to begin the web app creation process.

Setting up the Web AppSetting up the Web App

You should now have a working web application. This web app will be your Azure WordPress blog’s home base!

Setting up an Azure WordPress Web App

Now that the MySQL database and web app have been set up, it’s time to configure the two resources to communicate with one another and install WordPress.

To begin, establish an app configuration with some key/value pairs that will enable the web app to connect to the database. The keys below operate in conjunction with the WordPress container image to determine what is required to connect the container to the MySQL database.

  • WORDPRESS DB HOST
  • WORDPRESS DB USER
  • WORDPRESS DB PASSWORD
  • define(‘MYSQL CLIENT FLAGS’, MYSQLI CLIENT SSL’, WORDPRESS CONFIG EXTRA);

Additional app service configuration variables are not required by default. This guide will show you how to set up an app service to allow WordPress to access to the database via an SSL connection.

With your newly formed app service blade selected in the Azure portal:

  1. Select the Configuration option under Settings.
  2. Now, as application settings, add each of the keys listed above.

Entering the WORDPRESS DB HOST in the application settingsEntering the WORDPRESS DB HOST in the application settings

You should now see the following application settings once you’ve added all of the key/value pairs to the app service configuration.

Checking all of the application's settingsChecking all of the application’s settings

4. Finally, click Save. When you re-deploy the WordPress container image, the web app will restart and utilize those settings.

Now it’s time to install WordPress on Azure!

WordPress installation in Azure

You may finally start installing WordPress now! However, since WordPress is pre-installed on the Docker web app container mentioned above, all you have to do is configure it to operate with your database.

  1. Find the public URL of the Azure web app you just built. The URL may be found on the Overview tab of your web app.

1647493502_989_How-to-Set-Up-a-WordPress-Blog-in-Microsoft-AzureOverview of Azure web apps

2. Go to your web application’s public URL. If everything is working well, you should be sent to the WordPress installation screen.

The WordPress installer's language selection sectionThe WordPress installer’s language selection section

3. Click Install after entering the standard installation information.

The WordPress installation information screen is typical.The WordPress installation information screen is typical.

4. A Success page will appear if the installation was successful.

The WordPress installer's success screenThe WordPress installer’s success screen

5. Finally, go back to the public URL and you should see the default theme with the placeholder word hello world.

The WordPress installation's default theme and homepageThe WordPress installation’s default theme and homepage

Congrats! You’ve completed the installation of an Azure WordPress blog!