DEV Community

Joseph Adamu
Joseph Adamu

Posted on • Originally published at nginx-setup.hashnode.dev on

“From Zero to NGINX Hero: My DevOps Stage 0 Adventure”

Drama, suspense, and a happy ending included! 🔥


Introduction

As a budding DevOps enthusiast, my first hands-on task was setting up an NGINX web server on a fresh Ubuntu machine. This foundational exercise aimed to teach server configuration, troubleshooting, and deploymentskills critical for roles like DevOps Engineers and CI/CD Pipeline Engineers. In this blog, Ill walk through my journey, the hurdles I faced, and how this task aligns with my career aspirations.

Approach

Step 1: Installing NGINX

I started by updating the Ubuntu package repository and installing NGINX using:

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

After installation, I verified NGINX was running:

sudo systemctl status nginx
Enter fullscreen mode Exit fullscreen mode

Step 2: Creating the Custom HTML Page

I replaced the default landing page by creating a new index.html at /var/www/html/:

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

I added a simple HTML template with the required message:

<!DOCTYPE html> <html> <head> <title>DevOps Stage 0</title> </head> <body> <h1>Welcome to DevOps Stage 0 - TechGee</h1> </body> </html>
Enter fullscreen mode Exit fullscreen mode

Step 3: Configuring Permissions and Testing

To avoid permission issues, I set ownership of the /var/www/html directory to the web server user:

sudo chown -R www-data:www-data /var/www/html
Enter fullscreen mode Exit fullscreen mode

Finally, I reloaded NGINX to apply changes:

sudo systemctl reload nginx
Enter fullscreen mode Exit fullscreen mode

Challenges & Solutions: The Oops, I Did It Again Edition 🎭


Challenge 1: Firewall, the Over-enthusiastic Bouncer 🚧

Problem : My NGINX server was ready to party, but Ubuntu's firewall (UFW) was like, NOPE. Port 80? Never heard of her.

Solution : I whispered the magic words:

sudo ufw allow 'Nginx HTTP'
Enter fullscreen mode Exit fullscreen mode

Moral of the Story : Firewalls are the bouncers of the internet. Always check the guest list.


Challenge 2: Permission Denied? More Like Permission Confused 🔑

Problem : My HTML page was MIA. Turns out, the file was owned by rootthe ultimate gatekeeper. NGINX, being a mere mortal (www-data), couldn't read it. 🙈

Solution : I handed over the keys:

sudo chown www-data:www-data /var/www/html/index.html # "Here, NGINX. This is YOUR house now." 🏠
Enter fullscreen mode Exit fullscreen mode

Moral of the Story : Sharing is caring. Especially with web servers.


Challenge 3: The Case of the Missing Semicolon 🔍

Problem : I edited the NGINX config like a coding wizard until I missed a ;. NGINX responded with: Error 500: LOL, nice try.

Solution : I became Sherlock Holmes of Syntax:

sudo nginx -t # Spoiler: It yelled, Missing semicolon at line 13! 🕵
Enter fullscreen mode Exit fullscreen mode

Then, I raided the logs:

tail -f /var/log/nginx/error.log # Ah-ha! Theres the culprit! 🎯
Enter fullscreen mode Exit fullscreen mode

Moral of the Story : Semicolons are the pepperoni of codesmall but essential. 🍕


Why You'll Remember This Forever 🌟

  • Firewalls are drama queens.

  • Permissions are like relationships; communication is key.

  • Typos are the universes way of keeping you humble.

Now go forth, and may your servers never throw a tantrum again! 🚀

(P.S. If all else fails, scream sudo!! and pray.) 😇

Hiring Opportunities in DevOps and Related Fields

If you are looking to hire talent in the tech industry, consider the following roles:

  1. DevOps Engineers - Learn more

  2. Cloud Engineers - Learn more

This is intended for hiring managers and recruiters seeking qualified candidates in these specialized roles.


Conclusion

Completing this task was a small but significant step in my DevOps journey. It taught me resilience (debugging at 2 AM!), attention to detail, and the thrill of seeing Welcome to DevOps Stage 0 load on my screen. Im excited to tackle more complex tasksmaybe Docker or Kubernetes next!

To fellow beginners: Embrace the grind. Every error message is a lesson. 🚀


Ready to start your DevOps journey? Check out opportunities at HNG Tech!

]]>

Image of Datadog

Master Mobile Monitoring for iOS Apps

Monitor your app’s health with real-time insights into crash-free rates, start times, and more. Optimize performance and prevent user churn by addressing critical issues like app hangs, and ANRs. Learn how to keep your iOS app running smoothly across all devices by downloading this eBook.

Get The eBook

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More