How to set up WordPress behind Azure Front Door

Ajinkya Bapat 1 Reputation point
2022-06-02T06:51:30.07+00:00

I have WordPress site running on Azure VM(Ubuntu 18.04) at http://mysitename.centralus.cloudapp.azure.com.
I have set up both "home" & "siteurl" settings in "options.php" to the above hostname.

Now I want to setup Azure Front Door with custom domain & SSL certificates that I will be getting from my client.

1) I understand that I will be adding a CNAME record pointing to the Azure Front Door URL.
2) I also assume that I will be importing SSL certs in Azure Key Vault & granting Azure FD access to it.

But I am not sure about the settings I need to change on the WordPress, VM & Azure FD backend part.

1) How do I configure WordPress settings? Shall I set "home" & "siteurl" to the custom domain?
2) Do I need to add those SSL Certs on VM running Apache as well? or just adding them to FD will be sufficient?
3) How do I configure the Origin on Front Door? If I use Custom Host, what hostname shall I put? The VM one or the custom domain(surely not)? Or is there any other option to select backend host?

In short what I want is:

User enters: https://customdomain.com
Request goes to Front Door
Front Door redirects it to WP on VM
Content is displayed on the same URL: https://customdomain.com

Please assist.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,123 questions
Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
576 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,875 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Andriy Bilous 10,901 Reputation points MVP
    2022-06-02T09:01:44.333+00:00

    Hello @Ajinkya Bapat

    Your Azure Front Door cloud architecture for WordPress VM-s solution may look like:

    207679-image.png

    1) You need to modify your wp-config.php. It should contain the following settings:

    define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');  
    define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');  
    

    or you may change it to your domain

    define('WP_SITEURL', 'http://customdomain.com' );  
    define('WP_HOME', 'http://customdomain.com');    
    

    2) Add SSL certificates only to FD
    3) To configure an Azure VM as back-end-pool on Azure Front Door, you can do either of the following:
    Select Backend host type as Public IP address, select the correct subscription and add the NIC/Public IP of the VM which you want to add as the Backend host name.
    Select Backend host type as Custom host and add the FQDN/DNS name of the VM which has the Public IP address and application on it as the Backend host name.
    207852-image.png

    https://gunnarpeipman.com/wordpress-azure-front-door/

    If you think your question has been answered, click "Mark as Answer" if just helped click "Vote as helpful". This can be beneficial to other community members reading this forum thread.

    1 person found this answer helpful.