Updating NGINX default configurations on Azure App services Managed WordPress
Published Jan 05 2023 09:34 PM 10.4K Views

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.d
  • 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.



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


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





  • cd /home


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



  • 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/dev -> create a file -> command: touch startup.sh [If you have the startup.sh already, you can append the commands to the same file] 


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!!!

Version history
Last update:
‎Sep 14 2023 08:07 PM
Updated by: