This article is a continuation of Building a Scalable Web Application Part 1 I will recommend you go through that article before you proceed
Step 1: Set Up the Web Server
Install Apache (or another web server):
Once logged into your VM via SSH, update the package list: sudo apt update
Install Apache: sudo apt install apache2 -y
- Ensure Apache is running: sudo systemctl status apache2
Open Ports for HTTP/HTTPS:
Go to the "Networking" tab of your VM in the Azure portal.
Click "Add inbound port rule."
Add rules for HTTP (80) and HTTPS (443). for the demo purpose i will add just HTTP, but on Production you should add HTTPS or both depends on your company policy.
Step 2: Test the Web Server
Access the Web Server:
Open a web browser and navigate to the VM's public IP address (e.g.,
http://
52.170.74.101), am using my public IP address but you can link your custom domain to this web server, i will do a tutorial on that later.You should see the Apache default welcome page.
Step 3: Secure the Web Server
Install SSL (Optional for HTTPS):
You can install a free SSL certificate from Let's Encrypt using Certbot.
Follow the instructions from Certbot's website to secure your site.
Step 4: Clean Up (Optional)
Remove Resources:
- If you no longer need the VM, you can delete the resource group ("eastus-rg") to remove all associated resources.
This process will give you a fully functional web server running on an Azure VM.
Thank you
:Valentine Stephen