DEV Community

Oluwademilade Oyekanmi for AWS Community Builders

Posted on • Edited on

NGINX Configuration: My HNG DevOps Stage 0 Experience

Introduction

As part of the HNG DevOps Stage 0 task, I was required to set up and configure NGINX on a fresh Ubuntu server using any cloud platform of my choice, ensuring it serves a custom HTML page. This exercise aimed to demonstrate my ability to configure a web server and deploy a simple static site.

At first glance, this may seem like a simple task—after all, installing a web server and displaying a basic page shouldn’t be that difficult, right? But as with most things in DevOps, the real value isn’t in blindly following steps; it’s in understanding why each step matters, how to troubleshoot issues efficiently, and how to apply these concepts in real-world environments.

In this post, I’ll walk through my approach to completing this task, the challenges I encountered, how I resolved them, and the broader lessons this exercise reinforced about working as a DevOps engineer.

Steps Taken

1. Provisioning an AWS EC2 Instance
A good DevOps engineer must be comfortable working with cloud infrastructure. I chose AWS as my cloud provider. I launched an EC2 instance using the Ubuntu AMI, carefully configuring security groups to allow HTTP traffic (port 80) and SSH access (port 22).

2. Downloading the Key and Logging In
After the instance was provisioned, I downloaded the private key (.pem file) and logged in using SSH:

ssh -i my-key.pem ubuntu@<server-ip>
Enter fullscreen mode Exit fullscreen mode

At this stage, an error message could have slowed me down. I initially forgot where my key file was saved, but a quick check of my download directory saved me from unnecessary frustration.

3. Updating the System Packages
Before installing NGINX, I made sure my package list was up to date:

sudo apt update
Enter fullscreen mode Exit fullscreen mode

This step is essential because outdated package lists can cause unexpected installation errors—a common oversight that can lead to unnecessary debugging later.

4. Installing NGINX
With the system updated, I installed NGINX by running:

sudo apt install nginx -y
Enter fullscreen mode Exit fullscreen mode

5. Verifying NGINX Installation
To confirm that NGINX was installed and running correctly, I checked its status:

systemctl status nginx
Enter fullscreen mode Exit fullscreen mode

If it was not running, I would have started it manually with:

sudo systemctl start nginx
Enter fullscreen mode Exit fullscreen mode

6. Locating and Modifying the Default HTML File
Here’s where I encountered one of my biggest challenges.

I wasn’t immediately sure where the default NGINX HTML file was. Was it /usr/share/nginx/html/index.html or /var/www/html/index.html? I debated between both paths before finally checking the NGINX configuration in /etc/nginx/sites-enabled/default. A simple look there earlier would have saved me time!

Once I confirmed the correct location (/var/www/html/index.html), I edited the file:

cd /var/www/html
sudo nano index.html
Enter fullscreen mode Exit fullscreen mode

I replaced the existing content with the required message:

<!DOCTYPE html>
<html>
<head>
    <title>Welcome</title>
</head>
<body>
    <h1>Welcome to DevOps Stage 0 - [Your name here]/[Your username here]</h1>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

7. Restarting NGINX
After saving the file, I restarted NGINX to apply the changes:

sudo systemctl restart nginx
Enter fullscreen mode Exit fullscreen mode

8. Testing the Configuration

The final step was to confirm everything worked as expected. I opened a browser and navigated to:

http://<your-server-ip>/
Enter fullscreen mode Exit fullscreen mode

Seeing my custom message confirmed that everything was set up correctly.

Challenges and How I Overcame Them

  1. Misplacing the Private Key File
    At first, I couldn’t log in via SSH because my terminal couldn’t locate the .pem file. The solution? Checking the correct directory and rerunning the command. This was a reminder that even small errors can waste time if not caught quickly.

  2. Uncertainty About the NGINX Default Directory
    I spent unnecessary time debating between different file paths. A quick check of /etc/nginx/sites-enabled/default would have clarified it instantly. The lesson here? Read instructions carefully before jumping into troubleshooting.

  3. Permission Errors While Editing HTML
    While modifying index.html, I ran into permission errors. Using sudo solved the problem, but it reinforced the importance of understanding file permissions and privilege management.

Personal Growth

This task may have seemed straightforward, but the growth it sparked was immense. Every step reinforced the importance of resilience, adaptability, and problem-solving—qualities that go beyond just configuring a web server.

  1. Patience and Attention to Detail – I learnt the hard way that missing a simple detail, like the correct HTML file path, can lead to unnecessary troubleshooting. Slowing down and reading configurations properly saved me time.

  2. Confidence in Debugging – Every roadblock was an opportunity to sharpen my troubleshooting mindset. Instead of panicking, I approached problems systematically and solved them efficiently.

  3. Building Resilience – I faced errors, hit dead ends, and had to restart processes, but that’s exactly what makes DevOps exciting. Overcoming challenges is part of the journey, and this experience solidified my ability to push through obstacles.

  4. Embracing a Growth Mindset – DevOps isn’t about memorising commands; it’s about constantly learning, adapting, and improving. This task was just one step, but it reminded me that every challenge is an opportunity to grow.

Ultimately, this wasn’t just about setting up NGINX, it was about becoming a better problem solver, a more confident engineer, and a more resilient individual.

At this point, it’s clear that HNG doesn’t just teach you technical skills—it prepares you to think like a DevOps engineer. But this task? It’s just the beginning.

HNG: A Proven Hub for Elite DevOps Talent

This project, while valuable, barely scratches the surface of what HNG engineers are capable of.

HNG isn’t just another training program—it’s an intensive, real-world simulation that pushes engineers beyond basic configurations. It tests problem-solving skills, adaptability, and the ability to function in high-stakes DevOps environments.

HNG has produced top-tier engineers who have mastered automation, cloud-native technologies, infrastructure management, security, and scalability—all essential for today’s evolving tech landscape. These graduates emerge with battle-tested expertise, making them an asset to any organisation looking for skilled professionals.

Looking to Hire the Best? Start with HNG!

If you're a company seeking top DevOps, Cloud, and Infrastructure Engineering talent, hiring from HNG should be your first priority.

HNG alumni have demonstrated their ability to thrive in high-pressure environments, adapt to industry trends, and deliver production-ready solutions.

Explore elite HNG talents available for hire:

With a track record of producing world-class engineers, HNG remains the premier destination for companies seeking elite tech talent.

So, if you're looking for talents who can truly deliver, start your search here.

Top comments (0)