Introduction
As part of the DevOps Stage 0 task, I was required to set up and configure an NGINX web server on a fresh Ubuntu instance. This task aimed to test my ability to work with basic web server configurations while ensuring my deployed server was publicly accessible. I chose AWS EC2 for this deployment, as it provides a scalable cloud environment and a free tier for beginners.
Getting Started with EC2
Setting up an EC2 instance was straightforward. I used the following selections:
- Ubuntu 22.04 LTS AMI (Amazon Machine Image).
- Chose the t2.micro instance (eligible for the AWS Free Tier).
- Configured security settings to allow HTTP (port 80) and SSH (port 22).
- Generate an SSH key pair to securely connect to my instance using .ppk.
- Then launched my instance.
Challenges Faced
Deciding which cloud platform to use to deploy my web server is one of the challenge I encountered because of incurring costs. I wanted a cost-effective solution without unexpected charges. Considering all the various platforms, like AWS, Azure, and Google Cloud, I eventually chose AWS EC2 Free Tier, which offers 750 hours per month for free.
Another issue was configuring security groups correctly. Initially, my web page was not accessible because my EC2 security group did not allow inbound HTTP traffic. I resolved this by updating the inbound rules to allow traffic on port 80 (HTTP).
Setting Up NGINX
Once my EC2 instance was running, I followed these steps to install and configure NGINX:
- Update and Install NGINX
sudo apt update && sudo apt upgrade -y
sudo apt install nginx -y
- Verify NGINX is Running
sudo systemctl status nginx
- Create a Custom HTML Page
sudo nano /var/www/html/index.html
I added the following content:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>DevOps Stage 0</title>
</head>
<body>
<h1>Welcome to DevOps Stage 0 - [Your Name]/[SlackName]</h1>
</body>
</html>
- Restart NGINX to Apply Changes
sudo systemctl restart nginx
- Test the Setup I accessed my public IP address:
http://<your-ec2-public-ip>/
and confirmed that my custom message was displayed.
Key Takeaways
This task taught me several important lessons:
✅ How to launch an EC2 instance and configure it for web hosting.
✅ Setting up a basic web server using NGINX.
✅ Managing AWS security settings to allow public access.
✅ Troubleshooting connectivity issues related to firewall and inbound rules.
Final Thoughts
Deploying NGINX on AWS EC2 was a valuable hands-on experience. It solidified my understanding of cloud infrastructure, security groups, and web server configurations. This task aligns perfectly with my goal of becoming a DevOps Engineer and DevSecOps Engineer in AWS and Azure.
References
- DevOps Engineers
- Cloud Engineers
- Site Reliability Engineers
- Platform Engineers
- Infrastructure Engineers
- Kubernetes Specialists
- AWS Solutions Architects
- Azure DevOps Engineers
- Google Cloud Engineers
- CI/CD Pipeline Engineers
- Monitoring/Observability Engineers
- Automation Engineers
- Docker Specialists
- Linux Developers
- PostgreSQL Developers
Top comments (2)
Nice. Weldon!!
Thank you sir