INTRODUCTION
Handling millions of request by a website without crash can be attributed to the power of a well-configured web server and NGINX is a popular choice for its speed and efficiency. This post provides a step-by-step guide to configuring the NGINX web server on an Amazon EC2 instance using Ubuntu Server. I'll show you how to install and configure NGINX on an Amazon EC2 instance running Ubuntu Server. This is my first project at HNG DevOps internship training.
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
- port: Port 80 (HTTP): This allows access to your web server over HTTP.
Connect to the EC2 instance:
Connect this by selecting on your instance, click connect and use Ec2 direct connect.
Update the package list:
sudo apt update
Installation of Nginx:
sudo apt install nginx -y
Start and enable nginx to run on boot:
sudo systemctl start nginx
sudo systemctl enable nginx
*Configure the html page:
*
First open the index.html file:
sudo nano /var/www/html/index.html
Then,
Add the html content
Save and exist
Restart the nginx server to effect the change:
sudo systemctl restart nginx
Verify if the nginx web server is running:
sudo systemctl status nginx
Open a web browser and verify:
http://your-server-ip
_CHALLENGES FACED WORKING ON THIS PROJECT.
_
While creating my instance I encountered issues choosing my CIDR block as it keeps giving error message that its overlapping so I had to choose a different CIDR block different from what I had before.
CONCLUSION:
By following these steps, you now have a fully functional NGINX web server running on your EC2 instance. This is a fundamental skill for any developer or DevOps engineer, enabling you to host websites, APIs, and other web applications. NGINX's performance and reliability will provide a solid foundation for your projects.
REFERENCES:
DevOps Engineer
Cloud Engineers.
Infrastructure Engineers.
AWS Solutions Architects.
Azure DevOps Engineer.
Google Cloud Engineer.
CI/CD Pipeline Engineers..
Top comments (2)
nice work !
Thank you so much, comrade!!!