Jump to content

Updating NGINX default configurations on Azure App services Managed WordPress


Recommended Posts

Guest karthi2210
Posted

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.

 

 

777x414vv2.png.a8d2b659307bdf464874496e43a4cb4a.png

 

 

 

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.

 

863x207vv2.png.f1f1fcc40dafdb8ae1c8e838d46bbe0f.png

 

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.

 

 

751x152vv2.png.7cdd4b951fbd1552ba81d203d0bac7e9.png

 

 

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,

 

 

817x476vv2.png.bc1156d74f15eda6d965f902f717d6b8.png

 

 

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

 

 

760x285vv2.png.80e3c859e62bde19bdb24c1afa406b2c.png

 

 

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

 

 

695x66vv2.png.08d5d7894b05ba7f2f48327028143454.png

 

 

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

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...