DEV Community

Ameh Mathias Ejeh
Ameh Mathias Ejeh

Posted on

Configuring NGINX Web Server on Amazon EC2 Instance using Ubuntu server. My Stage 0 DevOps Task

Introduction

Deploying a web server on a cloud platform is a fundamental skill for DevOps professionals. This document outlines the process of installing and configuring the NGINX web server on an Amazon EC2 instance running Ubuntu. The goal is to set up a functional web server that serves a custom webpage, demonstrating foundational cloud infrastructure management and web server configuration skills. I am delighted to start my HNG DevOps internship training with this project.

Project Setup

Launch an Amazon EC2 Instance

  • Instance name: Nginx instance
  • AMI: Ubuntu server 24.04
  • Instance type: t2 micro
  • Key pair: nginx-key
  • Security group: Allow SHH traffic form anywhere.

Image description

Connect to the EC2 instance

  • Next connect to the EC2 instance and update the package list.
sudo apt update

Enter fullscreen mode Exit fullscreen mode

Image description

  • Install nginx
sudo apt install nginx -y 
Enter fullscreen mode Exit fullscreen mode

Image description

  • Start and enable nginx to run on boot
sudo systemctl start nginx
sudo systemctl enable nginx

Enter fullscreen mode Exit fullscreen mode

Image description

Configure the html page

  • Open the index.html file
sudo nano /var/www/html/index.html

Enter fullscreen mode Exit fullscreen mode
  • Add the html content
  • Save and exist.

Image description

Restart nginx

  • Restart the nginx server to effect the change.
sudo systemctl restart nginx
Enter fullscreen mode Exit fullscreen mode

Verify the Setup

  • To verify if the nginx web server is running
sudo systemctl status nginx
Enter fullscreen mode Exit fullscreen mode

Image description

  • Open a web browser and verify
http://your-server-ip
Enter fullscreen mode Exit fullscreen mode

Image description

Challenge Faced

Accessing my web page through the public ip address was futile, so I had to configure an inbound http traffic by allowing access from anywhere at port 80 and the challenge was solved.

The Importance of this Task to my DevOps Career

This project is crucial for understanding the fundamental concepts of cloud computing and DevOps. By setting up an NGINX web server on an AWS EC2 instance, I have:

  • Gain experience with cloud infrastructure and resource management.
  • Learn how to configure and secure a web server.
  • Understand the basics of networking, including security groups and firewall rules.
  • Develop troubleshooting skills for common server deployment issues.

Conclusion

Successfully completing this project will enhance my ability to manage and deploy web applications in a cloud environment, an essential skill for any DevOps engineer.

References

Top comments (0)