Note: I have used this SKU size as it’s lightweight and sufficient for this lab exercise – Standard B1s (1 vcpu, 1 GiB memory)
First, we’ll create two Linux Ubuntu virtual machines in Azure. We’ll use Azure because it offers a quick and easy way to create virtual machines.
Step 1:
Repeat this process to create a second VM for the video server.
Step 2: Configure the Virtual Machines
Next, we’ll configure the virtual machines to serve static assets. We’ll use Nginx as the web server, but you can use any web server you prefer.
SSH into the image server VM or use Azure Run Command Tool.
Install Nginx by running the command
"sudo apt-get update && sudo apt-get install nginx".
Copy your images to the VM and place them in the “/var/www/html” directory.
Repeat this process on the video server VM, but copy your videos to the “/var/www/html/videos” directory.
A step by step walkthrough as per below;
Install Nginx
sudo apt-get -y update sudo apt-get -y install nginx
Create Images Folder Path
mkdir /var/www/html/images/ echo "<h1> This is the Images Server </h1>" > /var/www/html/images/index.html
Create Videos Folder Path
mkdir /var/www/html/videos/ echo "<h1>This is the Videos Server</h1>" > /var/www/html/videos/index.html
Step 3: Create the Application Gateway
Now, we’ll create the application gateway in Azure. This will enable us to route traffic to the correct VM based on the URL path.
Create Application Gateway
create application gateway public ip
create application gateway with images backend pool
create application gateway with videos backend pool
create application gateway images backend setting
create application gateway add multiple targets to create path-based rule
create application gateway add multiple images path-based rule
create application gateway videos backend setting
create application gateway add multiple videos path-based rule
create application gateway add backend targets
create application gateway frontend routing rules for backend pools
Browse to Video Server Resource
create application gateway and check health
Check Overview of Application Gateway
Awesome links for further reading;
Apache web server documentation: https://httpd.apache.org/docs/
Azure documentation: https://docs.microsoft.com/en-us/azure/
Ubuntu server documentation: https://ubuntu.com/server/docs
Virtual machines in Azure: https://docs.microsoft.com/en-us/azure/virtual-machines/
Application Gateway in Azure: https://docs.microsoft.com/en-us/azure/application-gateway/