# HNG DevOps - Stage 0

## Introduction

Starting my HNG Internship, one of the first tasks assigned to DevOps interns was to set up NGINX on Ubuntu and configure it to serve a custom web page. This task aimed to evaluate our ability to install, configure, and troubleshoot a web server from scratch. In this blog post, I’ll walk you through how I approached and completed this task, including any challenges I faced and the key lessons I learned.

---

## Task Overview

The task required me to:

1. Install the NGINX web server and ensure it is running.
    
2. Configure NGINX to serve a custom HTML page as the default page with the message:
    

```bash
Welcome to DevOps Stage 0 - Victor Iliya/Non-Existent
```

3. Write a blog post that documents your experience with this task.
    

## Step-by-Step Guide

### Install NGINX

1. **Created the Web Serve**r:
    
    The first thing I did was to create an EC2 instance on AWS to be my web server. I used an ubuntu AMI.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1739605365349/965ea950-9003-48bb-9c69-32d50011aa95.png align="center")

2. **Connect to the instance**
    
    There are many ways to connect to an EC2 instance, I used the EC2 instance connect.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1739605333296/9c14b739-400b-482b-a495-e44114bfa03e.png align="center")

3. **Update Ubuntu**
    
    Once connected to the EC2 instance, the first thing t do it to update the Linux server by running the code below.
    

```bash
sudo apt update
```

4. **Install NGINX**
    
    The next step is to install the NGINX service
    

```bash
sudo apt install nginx -y
```

5. **Enable and start NGINX**
    
    After installation, I enabled and started the NGINX service:
    

```bash
sudo systemctl enable nginx
sudo systemctl start nginx
```

6. **Confirm if NGINX is running**
    

```bash
systemctl status nginx
```

If everything worked correctly, you should have the following:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1739606304878/3f775358-8da0-4f09-a49e-564210ccf79a.png align="center")

### Configure the Default Web Page

1. **Modify the default index.html page:**
    
    For the server to display the page, you need to modify the default index.html page located at /vat/www/html/index.html.
    
    Use the vim command for this as such:
    

```bash
vim /var/www/html/index.html   
```

Now, to modify text files with vim, press the “ i “ key on the keyboard which is for insert, and now you’d be able to enter the text you want, in my case it would be “Welcome to DevOps Stage 0 - Victor Iliya/ Non-Existent“

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1739608044916/3aa0313b-a3a5-4a66-9f57-5e259aa579bc.png align="center")

Now to save the file, perform the following:

* press the “ esc “ key to exit the insert mode.
    
* type `:wq!` and press the enter key to save the file and close the vim editor.
    

Note: If the permission is denied, use sudo as such:

```bash
sudo vim /var/www/html/index.html
```

2. **Restart the NGINX server**
    
    Restart the NGINX server to apply the changes
    
    ```bash
    sudo systemctl restart nginx
    ```
    

### Open your web page

Go back to your instance and find your public ip address, use this to access the site you’ve just made.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1739609091403/7d5db421-985e-44dc-8f6e-e9f4369e4797.png align="center")

**Note: Ensure the security groups for your instance allows HTTP traffic on port 80**

1. Hands-on experience installing and configuring NGINX
    
2. Debugging and troubleshooting web server issues
    
3. Improved Linux server management skills
    

### References

I explored different engineering roles at HNG for future career growth:

* [DevOps Engineers](https://hng.tech/hire/devops-engineers)
    
* [cloud Engineers](https://hng.tech/hire/cloud-engineers)
    

This was a great learning experience, and I’m excited for what’s next!
