Setting Up an NGINX Web Server on Azure and Local Machine: My DevOps Stage 0 Experience

B.G.Skillz šŸ§‘ā€šŸ’» - Feb 2 - - Dev Community

Introduction

As part of my DevOps Stage 0 Intership, I was tasked with setting up and configuring NGINX on a fresh Ubuntu Server. This Challenge aimed to test my ability to install and configure a web server while demonstrating and understanding of basic System Administration. In this blog, I document my approach, the challenges I faced and the lessons learned from the Task.
Approach to Completing the Task
For me to successfully configure NGINX, I followed a structured approach:
I register as a new user on Azure so that I will be able to access the Cloud Infrastructure and create a new/fresh Ubuntu Server.

Image description
After Create a new/fresh Ubuntu Server and selected all the necessary things I need to make the server work better.

  • Preparing the Server
    I used MobaXterm to connect to the Server using IP address, my Admin Username and the Password I set. Before installing NGINX, I updated my server to ensure all system packages were current
    sudo apt update && sudo apt upgrade -y

  • Installing NGINX
    I installed NGINX using:
    sudo apt install nginx -y
    After the installation, I check to know if NGINX is running using command sudo systemctl status nginx it shows

Image description
It shows Active and Running and I enable and start nginx using sudo systemctl enable nginx sudo systemctl start nginx

  • Configuring Default Page
    I then customized the default web page by modifying the index.html file located at at /var/www/html/index.html. Using the nano text editor, I added the required message needed. sudo nano /var/www/html/index.html and I replaced the content in it with
    `



    Welcome to HNG DevOps Internship

    Welcome to DevOps Stage 0- Bolarinwa Gbolahan/Bolarinwa




    After writing the code I save with Ctrl X then Y and Press Enter. I restart the NGINX using command
    sudo systemctl restart nginx`.

  • Verifying the Configuration

    I check if everything was working correctly, I tested the setup in a web browser by using my IP address and it works perfectly both on Local Machine and Azure Ubuntu Server

Challenges Faces and How I Overcame them

  1. NGNIX Not starting after installation I encountered an issue where NGINX wouldn't start. Checking the service status with sudo netstat -tulnp | grep :80
  2. Firewall Blocking HTTP Requests After configuring NGINX, I realized my webpage wasn't accessible from a web browser. So I troubleshoot this by sudo ufw status

How this task contribute to my DevOps Learning

The task reinforced my understanding of Ubuntu System Administration, Web Server, NGINX Server, and networking.

References

DevOps Engineer
Cloud Engineers
Platform Engineers

. . . .