Introduction
As part of the HNG DevOps internship, I completed Stage 0: NGINX Configuration by installing and configuring an NGINX web server on an Ubuntu machine. This blog post provides a guide, detailing my approach, challenges faced, solutions implemented, and key takeaways from this task.
Task Overview
The objective of this task was to:
- Install and configure NGINX on an Ubuntu server.
- Replace the default NGINX page with a custom HTML file displaying:
Welcome to DevOps Stage 0 - [Your Name]/[SlackName]
- Ensure the page is accessible via a public IP address.
Step-by-Step Approach
1️⃣ Setting Up the Ubuntu Server on Azure
Since the task required a fresh Ubuntu instance, I deployed an Ubuntu 22.04 virtual machine on Microsoft Azure following these steps:
Logged into the Azure Portal.
Navigated to Virtual Machines and selected Create > Azure Virtual Machine.
- Selected Ubuntu 22.04 LTS as the OS and Configured the machine.
- Configured Inbound Port Rules, initially allowing only SSH (port 22), which later caused accessibility issues.
- After deployment, copied the Public IP Address and connected via SSH:
ssh username@my-server-ip
2️⃣ Updating the System
Before installing any software, I updated the system to ensure the latest security patches and package versions:
sudo apt update && sudo apt upgrade -y
3️⃣ Installing NGINX
To install and verify NGINX:
sudo apt install nginx -y
sudo systemctl status nginx
If the service isn't running, start it manually but in case I didn't need to do this:
sudo systemctl start nginx
To ensure NGINX starts automatically at boot, enable the service:
sudo systemctl enable nginx
4️⃣ Configuring the Custom Web Page
To meet the task requirements, I modified the index.html file:
sudo nano /var/www/html/index.html
Replaced the default content with:
<!DOCTYPE html>
<html>
<head>
<title>Welcome</title>
</head>
<body>
<h1>Welcome to DevOps Stage 0 - [Your Name]/[SlackName]</h1>
</body>
</html>
After saving the file, I restarted NGINX:
sudo systemctl restart nginx
5️⃣ Configuring Inbound Port Rules on Azure
Initially, I couldn't access the web page due to inbound rule restrictions. I resolved this by allowing HTTP (port 80) traffic.
Using the Azure Portal:
- Navigated to Virtual Machines > Selected my VM > Networking > Network settins.
- Clicked Create port rule.
- Set Destination Port to
80
, Protocol toTCP
, and Action toAllow
. - Save the changes.
6️⃣ Testing the Web Page
I confirmed the setup by opening a browser and visiting:
http://my-server-ip:80
The custom message successfully displayed, indicating a successful configuration.
Challenges & Solutions
🔴 Challenge 1: Choosing the Right Server and Public IP Availability
issue: The first challenge I faced was deciding which server to use for this project. Initially, I considered using my Raspberry Pi, but I encountered difficulties with obtaining a stable public IP address due to ISP restrictions.
Solution: To overcome this, I opted for Microsoft Azure, which provides a reliable public IP by default, ensuring seamless deployment and accessibility.
🔴 Challenge 2: Configuring Inbound Ports on Azure
Issue: I initially allowed only SSH traffic, preventing access to NGINX.
Solution: I modified the network security group settings to allow inbound traffic on port 80 via both the Azure portal and CLI.
Key Takeaways
This project provided invaluable hands-on experience with:
Cloud Infrastructure: Setting up an Ubuntu VM on Azure.
Linux Server Management: Handling SSH connections and package management.
Web Server Configuration: Installing and managing NGINX.
Networking & Security: Configuring inbound rules to allow web traffic.
Troubleshooting: Debugging issues related to firewall rules and NGINX status.
How This Task Helps My DevOps Journey
Completing this task gave me practical experience in Linux system administration, networking, and troubleshooting—fundamental DevOps skills. I also improved my ability to document configurations and resolve real-world deployment challenges.
Conclusion
This experience improved my ability to set up, configure, and troubleshoot web servers while reinforcing best practices for cloud security and networking. Looking forward to more HNG tasks! 💪
Looking to Hire?
Find top-tier engineers at HNG:
- DevOps Engineers
- Cloud Engineers
- Site Reliability Engineers
- Platform Engineers
- Infrastructure Engineers
- Kubernetes Specialists
- AWS Solutions Architects
- Azure DevOps Engineers
- Google Cloud Engineers
- CI/CD Pipeline Engineers
- Monitoring/Observability Engineers
- Automation Engineers
- Docker Specialists
- Linux Developers
- PostgreSQL Developers
Top comments (0)