DEV Community

Olajide Ajisegiri
Olajide Ajisegiri

Posted on

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

INTRODUCTION

In today's digital landscape, ensuring a website can handle millions of requests without crashing requires a well-optimized web server. NGINX is a widely recognized choice due to its speed, efficiency, and scalability.

This post provides a comprehensive, step-by-step guide to setting up and configuring an NGINX web server on an Amazon EC2 instance running Ubuntu Server. I will walk you through the installation process and essential configurations to optimize performance.

This project marks the beginning of my journey in the HNG DevOps Internship Training, where I am gaining hands-on experience in deploying and managing scalable web applications.

Stay tuned as I break down the process to help you get started with NGINX on AWS!

Project Setup

*Launch an Amazon EC2 Instance.

Instance name: nginx server
AMI: Ubuntu server 24.04
Instance type: t2 micro
Key pair: nginx-key1
Security group: Allow SHH traffic form anywhere
port: Port 80 (HTTP): This allows access to your web server over HTTP.
Image description

Connect to the EC2 instance:

Connect this by selecting on your instance, click connect and use Ec2 direct connect.

**
Image description**

Image description

Installation of Nginx:

Image description

Image description

Start and enable nginx to run on boot:

Image description

Image description

Configure the html page:

First open the index.html file:

Image description

Then,
Add the html content
Save and exist
Image description

Restart the nginx server to effect the change:

Image description

Verify if the nginx web server is running:

Image description

Image description

Open a web browser and verify:

Image description

Image description

Challenges Faced During This Project
One of the key challenges I encountered while setting up my EC2 instance was an issue with the CIDR block configuration. Initially, I kept receiving an error message indicating that my chosen CIDR block was overlapping with an existing one. To resolve this, I had to select a different CIDR block that did not conflict with my previous configurations. This experience reinforced the importance of understanding networking fundamentals when working with cloud infrastructure.

Conclusion
By following these steps, you now have a fully functional NGINX web server running on your AWS EC2 instance. Mastering this process is an essential skill for developers and DevOps engineers, as it enables seamless deployment of websites, APIs, and other web applications. With NGINX's high performance and reliability, you have a strong foundation to build and scale your projects efficiently.

This project has been an invaluable learning experience in my HNG DevOps Internship Training, and I look forward to exploring more advanced cloud configurations in the future.

REFERENCES:
DevOps Engineer
Cloud Engineers.
Infrastructure Engineers.
AWS Solutions Architects.
Azure DevOps Engineer.
Google Cloud Engineer.
CI/CD Pipeline Engineers..

Top comments (0)