Deploying a Static Website on AWS Ubuntu EC2 with Apache2
In my journey of exploring cloud computing, I recently deployed a static website on an AWS EC2 instance running Ubuntu, using Apache2 as the web server. This hands-on project helped me strengthen my understanding of server hosting, Linux commands, and cloud infrastructure.
Requirements
Step 1: Launch an Ubuntu EC2 Instance
Step 2: Connect to the EC2 Instance
Use your terminal to connect to the EC2 instance using SSH:
ssh -i <your-key.pem> ubuntu@<your-ec2-public-ip>
Step 3: Update System Package
Update the package index before installing new software:
sudo apt update
Note: On Ubuntu we use apt; for CentOS it would be dnf.
Step 4: Install Apache2
Install Apache2 using the following command:
sudo apt install apache2 -y
Step 5: Check Apache2 Status
Verify that Apache2 is active and running:
sudo systemctl status apache2
If it shows “active (running),” you're good to go!
Step 6: Deploy Your Website
1.Download or prepare your static HTML files.
2.If it's a ZIP file, unzip it:
Recommended by LinkedIn
unzip <your-file.zip>
3.Navigate to the web root directory:
cd /var/www/html
4.Optionally delete the default index.html
sudo rm index.html
5.Copy your static files:
sudo cp -r /path-to-your-files/* /var/www/html
Step 7: Browse Your Website
Open your browser and go to:
http://<your-ec2-public-ip>
You should now see your live website!
Troubleshooting
sudo systemctl restart apache2
Conclusion
This was my first deployment on AWS, and it was a rewarding experience. Hosting your own website on the cloud teaches you more than theory—it gives you practical control over the full deployment stack.
Thanks for reading! 🙌
Feel free to connect with me or drop a comment if you’re trying this out too!
Connect with me: