NGINX Setup: DevOps Stage 0

GrimGrim
3 min read

Introduction

As part of the DevOps Stage 0 internship task, I was challenged to set up and configure NGINX on a fresh Ubuntu server hosted on a cloud provider. This exercise aimed to test foundational DevOps skills like cloud infrastructure provisioning, server management, and web server configuration. Here’s a detailed account of my experience, challenges, and takeaways.

Approach to the Task

The task required provisioning a cloud server, installing NGINX, and configuring it to serve a custom HTML page. Here’s my step-by-step approach:

  1. Signing Up for a Cloud Provider
    I chose AWS as my cloud platform (though providers like Google Cloud or Azure work similarly). After creating an account, I navigated to EC2 to launch an Ubuntu server instance.

    • Selected Ubuntu 22.04 LTS as the OS.

    • Configured a t2.micro instance (free tier eligible).

    • Set up SSH key pairs for secure access.

    • Added firewall rules (security groups) to allow HTTP (port 80) and SSH (port 22) traffic.

  2. Connecting to the Cloud Server
    Using the terminal, I connected to the instance via SSH:

     ssh -i "my-key.pem" ubuntu@<server-public-ip>
    
  3. Installing NGINX
    After accessing the server, I updated the package list and installed NGINX:

     sudo apt update  
     sudo apt install nginx -y
    

    Verified the service was running:

     sudo systemctl status nginx
    
  4. Creating the Custom HTML Page
    I replaced the default NGINX index file at /var/www/html/index.html with a simple HTML page:

     <p>Welcome to DevOps Stage 0 - Olusi Boluwatife/Grim</p>
    
  5. Testing the Configuration
    I used curl localhost to confirm the page loaded. Finally, I accessed the server’s public IP in my browser to validate external accessibility.

Challenges Faced

While the task built my confidence, I encountered several hurdles:

  1. Cloud Provider Setup Complexity
    As a first-time AWS user, the EC2 dashboard felt overwhelming. I accidentally misconfigured security groups initially, blocking HTTP traffic. Referencing AWS’s documentation helped me correct the rules.

  2. SSH Key Permissions
    My first SSH attempt failed due to incorrect key file permissions. Fixing it required:

     chmod 400 my-key.pem
    
  3. Firewall Conflicts
    The Ubuntu server’s built-in firewall (ufw) was inactive by default, but AWS security groups handled traffic. Later, enabling ufw without allowing NGINX caused conflicts. I standardized on AWS security groups to avoid confusion.

How This Task Contributes to My Goals

This task aligns with my aspiration to become a DevOps Engineer by:

  1. Introducing Cloud Infrastructure: Provisioning servers on AWS gave me hands-on exposure to cloud platforms, a cornerstone of modern DevOps.

  2. Strengthening Deployment Skills: Configuring NGINX on a remote server mirrors real-world application deployment workflows.

  3. Building Troubleshooting Acumen: Debugging SSH and firewall issues sharpened my problem-solving skills.

As emphasized in this work so far, cloud expertise is vital for designing scalable systems. Similarly, the Infrastructure Engineer’s role underscores the importance of server management—skills I practiced here.

Key Takeaways

  • Cloud Agnosticism: While I used AWS, similar principles apply to Azure, Google Cloud, etc.

  • Security First: Properly configuring SSH and firewalls is non-negotiable.

  • Automation Potential: Manual setup works for small tasks, but tools like Terraform could automate cloud provisioning in the future.

Conclusion

This task was a holistic introduction to cloud DevOps. From provisioning infrastructure to deploying a web server, I gained practical insights into the lifecycle of application hosting. I’m eager to explore advanced areas like CI/CD pipelines and Kubernetes, as highlighted in HNG Tech’s hireable roles, and contribute to building robust, cloud-native systems.

References

0
Subscribe to my newsletter

Read articles from Grim directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Grim
Grim

I am