- Lab
- A Cloud Guru
Shared Application Configuration with Azure Files
Azure File Shares are a powerful tool for managing data in the cloud. The data stores that uses File Shares can take many forms, and it can even include configuration data. One way to use Azure Files shares is to store shared configuration files in them so that the shared configuration files can be accessed across multiple servers. In this lab, we will explore Azure File shares. We will configure an Nginx web server on two machines using a shared configuration file stored in an Azure File share. This will provide you with some hands-on experience with what it might look like to manage shared configuration using Azure File shares.
Path Info
Table of Contents
-
Challenge
Create a file share to store the shared configuration file.
- Log in to the Azure portal.
- Locate the storage account. The name of the storage account should begin with
webconfig
. - Click on the storage account, then select File Shares and click + File Share to create a new file share.
- Set the name of the new file share to
config
and click Create.
-
Challenge
Mount the File share to both web servers.
- On both servers, edit the
fstab
file usingsudo vi /etc/fstab
. - Add a new entry at the end of the file on each server. Replace the
<storage account name>
in the Samba address with your real storage account name, which you can find in Azure portal. With it, enter the following:
//<storage account name>.file.core.windows.net/config /etc/nginx/sites-enabled cifs nofail,vers=3.0,credentials=/etc/smbcredentials/webconfig.cred,serverino
- On both servers, finish mounting the File Share by mounting all filesystems in fstab using
sudo mount -a
.
- On both servers, edit the
-
Challenge
Create the shared configuration file within the file share.
- On one of the two servers, edit the config file using
sudo vi /etc/nginx/sites-enabled/default
. - Add the contents of the configuration file:
server { listen 80 default_server; listen [::]:80 default_server; root /www/satt; index index.html index.htm index.nginx-debian.html; server_name _; location / { try_files $uri $uri/ =404; } }
- On both servers, reload the Nginx configuration using
sudo nginx -s reload
.
You should be able to view the website by accessing either server's public IP address in a browser. You can also verify this when logged in to one of the servers with the
curl localhost
command. - On one of the two servers, edit the config file using
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.