Site icon TheWindowsUpdate.com

Updating NGINX default configurations on Azure App services Managed WordPress

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Community Hub.

Azure App services Managed WordPress is a new service offering provided by Microsoft Azure to host WordPress websites. It runs on a Linux machine and the technology on which this Managed WordPress site runs is PHP and the web server it uses is NGINX.

 

 

 

In this blog post, you will understand on how you can modify the default configurations of NGINX on Managed WordPress site on Azure app services.

 

On that note, let's quickly deep dive into the technical aspects of modifying the default configurations on Azure app service Managed WordPress website.

 

Now, let us quickly navigate to the Azure portal --> App service (Managed WordPress) --> click on SSH blade, this would take you to the WebSSH console.


This would open an SSH session for you as below and you can navigate to the path /etc/nginx/conf.d where you can find the file default.conf as shown below.

 

 

Commands to navigate:

  • cd /etc/nginx/conf.g
  • ls -lrt

 

And this default.conf has all the necessary location routes and other serve specific details, sample configuration in default.conf is as below,

 


 

Now, as a next step, you can copy this default.conf to /home which is a persistent storage on Azure app services.

 

Command:

  • cp /etc/nginx/conf.d/default.conf /home/default.conf

 

Now you can navigate to this default.conf file under /home

 


 

Command:

  • cd /home

 

To modify the default.conf file open with any editor like vim/vi,

 

Command:

  • vi /home/default.conf

 

You can make necessary changes to this default.conf file now and save it by giving [ESC + : + wq+ ENTER (KEY)]

 

Once saved, we need to create a startup script to tell NGINX to update this default.conf which is present in /home to /etc/nginx/conf.d. To create a startup script, you can follow the below steps.

 

Inside SSH -> /home -> create a file -> command: touch startup.sh

 

Now open that file using vi editor as -> vi startup.sh and provide the below content inside startup script

 


 

The first line will copy the configurations and the second line will reload the NGINX.

To run this bash script while starting the container, you can follow the steps outlined here - How to run Bash scripts in WordPress on Azure App Service - Microsoft Community Hub

 

Happy Learning!!!

Exit mobile version