Nginx - Hello World!

As part of my DevOps Stage 0 task, I was assigned to set up and configure NGINX on a fresh Ubuntu server hosted on Google Cloud Platform (GCP). This task was designed to test my ability to work with basic web server configurations and deliver a functional web server. Here’s a breakdown of my experience, challenges, and learnings.

Approach

  1. Setting up the GCP instance

    I started by creating a new virtual machine (VM) instance on GCP. I chose Ubuntu 20.04 LTS as the operating system and configured the instance with the necessary resources (1 vCPU and 3.75 GB RAM). After launching the instance, I connected to it via SSH using the GCP console.

  2. Installing NGINX

    Once connected to the VM, I updated the package list using sudo apt update. Then, I installed NGINX using the command sudo apt install nginx. After the installation, I ensured that NGINX was running by using sudo systemctl status nginx. This confirmed that the service was active

     sudo apt update
     sudo apt install nginx
     sudo systemctl start nginx
     sudo systemctl status nginx
    
  3. Configuring the nginx default page

    Next, I replaced the default NGINX landing page with a custom HTML page. I edited the file located at /var/www/html/index.html and added the following message:

     Welcome to DevOps Stage 0 - [Your Name]/[SlackName]
    

    I replaced [Your Name] with my actual name and [SlackName] with my Slack username.

  4. Configuring firewall rules

    To allow HTTP traffic to the VM, I configured the firewall rules in the GCP console. I added a new rule to allow ingress traffic on port 80 (HTTP) for all IP addresses (0.0.0.0/0). This is to ensure that the webpage is accessible from any browser.

Challenges

  1. Firewall Configuration on GCP
    Initially, I couldn’t access the server’s IP address in my browser. After some troubleshooting, I realized that the default firewall rules on GCP were blocking HTTP traffic. To resolve this, I added a new firewall rule to allow traffic on port 80, as described above.

  2. File Permissions
    When editing the index.html file, I encountered permission issues. I resolved this by using sudo to gain the necessary privileges to modify the file.

Contribution to learning goals

The task provided me with an hands-on experience on creating a simple web server on a remote virtual machine. It was a fun learning experience, despite the little challenges I encountered.

Further Reading

If you are a beginner devOps engineer like me, you might be interested in these engineering roles. Do well to check them out: DevOps Engineers , Cloud Engineers

Thanks for reading.