Introduction
As part of my DevOps internship journey, I was tasked with setting up and configuring NGINX on a fresh Ubuntu server. This task aimed to evaluate my ability to work with web server configurations and ensure I could deliver a functional web server. The final goal was to serve a custom HTML page displaying the message:
"Welcome to DevOps Stage 0 - Emmanuel Omoiya / Emmanuel Omoiya"
This blog post documents my approach, challenges faced, and key learnings from completing this task.
Step 1: Setting Up the Ubuntu Server
To begin, I set up an Ubuntu server on my preferred cloud platform. I used AWS EC2, but other options like Google Cloud or DigitalOcean could also be used. After launching the instance, I connected via SSH:
ssh ubuntu@<your-server-ip>
Tip: Ensure your security group allows inbound traffic on port 80 to make the NGINX server accessible publicly.
Step 2: Installing NGINX
Installing NGINX on Ubuntu was straightforward using the package manager:
sudo apt update
sudo apt install nginx -y
Once installed, I verified that NGINX was running with:
sudo systemctl status nginx
If not running, I started the service:
sudo systemctl start nginx
And enabled it to start on boot:
sudo systemctl enable nginx
At this stage, visiting http://<your-server-ip>/
in a browser should display the default NGINX Welcome Page.
Step 3: Configuring the Custom HTML Page
Next, I created a simple HTML file to serve as the default page:
sudo nano /var/www/html/index.html
I replaced its content with:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DevOps Stage 0</title>
</head>
<body>
<h1>Welcome to DevOps Stage 0 - Emmanuel Omoiya / Emmanuel Omoiya</h1>
</body>
</html>
After saving the file, I restarted NGINX to apply the changes:
sudo systemctl restart nginx
Now, visiting http://<your-server-ip>/
displayed the custom message.
Step 4: Verifying the Setup
To confirm everything was working correctly, I ran:
curl http://localhost/
The expected output should display the HTML content of my page. Additionally, I tested my server from a browser using the public IP address.
Challenges Faced and Solutions
1️⃣ NGINX Not Starting Due to Conflicts
At first, NGINX failed to start due to a port conflict. Running:
sudo lsof -i :80
showed that another process was using port 80. I resolved this by stopping the conflicting process:
sudo systemctl stop apache2
sudo systemctl disable apache2
2️⃣ Permission Issues While Editing HTML Files
When trying to edit /var/www/html/index.html
, I encountered permission errors. Granting necessary access fixed this:
sudo chmod -R 755 /var/www/html
Key Takeaways
This task reinforced several important DevOps concepts:
✅ Server Setup & Configuration – I gained hands-on experience installing and configuring NGINX on a cloud-based Ubuntu server.
✅ Web Server Basics – Understanding how NGINX serves static content and how to customize the default page was invaluable.
✅ Troubleshooting Skills – Debugging issues like port conflicts and permission errors improved my problem-solving skills.
This foundational knowledge will be crucial as I advance in my DevOps journey, especially in Site Reliability Engineering and Cloud Engineering.
Final Thoughts
Completing this task gave me a deeper understanding of NGINX, a core component in web infrastructure. It also prepared me for more advanced topics like reverse proxying, load balancing, and SSL configurations.
For those interested in DevOps roles, check out:
🔹 Site Reliability Engineers
🔹 Cloud Engineers
Would love to hear about your experience with NGINX! Drop a comment below. 🚀
Top comments (0)