✅ Day 15 of My Cloud Journey ☁️ — Launching a Web Server on EC2 (Apache/NGINX)

Today I took my cloud skills up a notch by launching a web server on AWS EC2 — exploring both Apache and NGINX setups. This task blends compute, networking, Linux administration, and cloud security, giving me a real-world feel of how apps are deployed in production.
🌐 Why This Matters
Learning to deploy a web server on EC2 teaches:
Basic cloud infrastructure deployment
Configuring secure and accessible cloud servers
Working with Linux and web server tools
Serving public content (static pages, APIs, apps)
It’s the entry point to cloud-native hosting, and it ties together the networking and security concepts I’ve learned in the past few days.
🧰 What I Used
Amazon EC2 (Amazon Linux 2)
VPC + Public Subnet + Route Table
Security Groups
SSH access
Apache & NGINX
Browser for web access
🛠️ Step-by-Step Setup
1️⃣ Create or Use Existing VPC Setup
Ensure:
You have a VPC with an Internet Gateway attached
A Public Subnet with auto-assign public IP enabled
A Route Table routing
0.0.0.0/0
to the IGW
🧠 This ensures your EC2 instance is publicly accessible.
2️⃣ Launch an EC2 Instance
AMI: Amazon Linux 2 (Free tier)
Instance Type:
t2.micro
Network: Choose your VPC and public subnet
Public IP: Auto-assign = Yes
Security Group: Create one with:
Port 22 (SSH) — your IP only
Port 80 (HTTP) — 0.0.0.0/0
3️⃣ Connect to EC2 via SSH
From your terminal or SSH client:
bashCopyEditssh -i your-key.pem ec2-user@<public-ip>
4️⃣ Install Apache Web Server
sudo yum update -y
sudo yum install httpd -y
sudo systemctl start httpd
sudo systemctl enable httpd
🧪 Test Apache:
Visit the EC2 Public IP in your browser
You should see the Apache test page
5️⃣ (Optional) Install and Test NGINX Instead
If you want to try NGINX:
sudo yum install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx
Visit your EC2 public IP again — now it should show the NGINX welcome page.
6️⃣ Customize the Web Page
Let’s personalize it:
For Apache:
bashCopyEditecho "<h1>🚀 Hello from Apache on Day 15!</h1>" | sudo tee /var/www/html/index.html
For NGINX:
bashCopyEditecho "<h1>🌐 Hello from NGINX on Day 15!</h1>" | sudo tee /usr/share/nginx/html/index.html
Refresh the browser and your message should appear!
📸 Architecture Overview
✅ EC2 launched inside a public subnet
✅ Security Group opens ports 22 and 80
✅ Apache or NGINX serves a custom webpage
✅ Route table ensures external access
🔐 Key Concepts Reinforced
EC2 Basics: Launch, connect, and manage compute instances
VPC Routing: Subnet + route table + IGW for internet access
Security Groups: Allowing HTTP and SSH access
Web Servers: Apache vs. NGINX setup and file locations
⚔️ Apache vs NGINX
Feature | Apache | NGINX |
Architecture | Process-based | Event-driven |
Performance | Good for dynamic content | Great for static content |
Config Flexibility | High | Lightweight but flexible |
Use Case | LAMP stack, legacy apps | High-performance proxies, APIs |
🧪 Real-World Use Cases
Hosting a static or dynamic website
Deploying monitoring dashboards
Building a full-stack app later (Node.js, Django, etc.)
Exploring reverse proxy and load balancing
📚 What I Learned Today
✅ Apache & NGINX setup on EC2
✅ Working with Linux-based package installs
✅ Routing, public IPs, and firewall configuration
✅ Customizing web pages on a cloud server
✅ Difference between Apache and NGINX architectures
📅 What’s Next?
Day 16: Deploying a Static Website Using NGINX on EC2 🌐🚀
Subscribe to my newsletter
Read articles from Pratik Das directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
