🖥️☁️Deploying a Personal Website on AWS EC2 with Apache
Deploying a Personal Website on AWS EC2 with Apache
Introduction
Hosting a personal website on AWS EC2 using Apache is a great way to showcase your portfolio, resume, or blog. This guide walks you through setting up an Ubuntu EC2 instance, installing Apache, deploying a static website, and customizing your content.
Step 1: Launch an EC2 Instance
- Sign in to AWS Console and navigate to the EC2 Dashboard.
- Click "Launch Instance" and configure:
- AMI: Ubuntu (Latest LTS)
- Instance Type: t2.micro (Free Tier eligible)
- Security Group: Allow SSH (22), HTTP (80), and HTTPS (443)
- Key Pair: Download the
.pem
file for SSH access.
- Launch the instance and note the Public IP/DNS.
Step 2: Connect to EC2 via SSH
Use the command below to access your instance:
ssh -i "your-key.pem" ubuntu@your-public-ip
Replace your-key.pem
with your key file and your-public-ip
with the EC2 instance's public IP.
Step 3: Install Apache Web Server
Update packages and install Apache:
sudo apt update
sudo apt install apache2 -y
Verify that Apache is running:
sudo systemctl status apache2
If it’s not running, start and enable it:
sudo systemctl start apache2
sudo systemctl enable apache2
Test by entering your EC2 Public IP in a browser. The default Apache page should load.
Step 4: Configure Security Group
If the website doesn’t load, modify the Security Group:
- Go to EC2 Dashboard → Security Groups.
- Select your instance’s security group → Edit Inbound Rules.
- Add rules for:
- HTTP (80): Anywhere (0.0.0.0/0, ::/0)
- HTTPS (443): Anywhere (0.0.0.0/0, ::/0)
Step 5: Download and Extract a Website Template
Navigate to the home directory and download a free template:
cd ~
wget https://kunruch.nyc3.digitaloceanspaces.com/templateflip/templates-free/creative-cv_free_1-1-0.zip
Install unzip
and extract files:
sudo apt install unzip -y
unzip creative-cv_free_1-1-0.zip
Step 6: Deploy the Website
Move extracted files to the Apache web root directory:
sudo cp -R creative-cv_free_1-1-0/* /var/www/html/
Ensure proper file structure:
cd /var/www/html/
ls
Your directory should contain index.html
, css
, js
, and other website assets.
Step 7: Customize Your Website
Edit the index.html
file to personalize content:
sudo vi /var/www/html/index.html
Modify the title and heading:
<title>Divya Rajurkar</title>
<h1>Welcome to My Personal Website</h1>
<p>I am a Data Engineer passionate about Big Data and Cloud Computing...</p>
Save and exit (ESC
, then :wq
).
Step 8: Restart Apache & Access the Website
sudo systemctl restart apache2
Now, open your browser and visit:
http://your-public-ip
Your website should be live! 🎉
Conclusion
Congratulations! You have successfully deployed your personal website on AWS EC2. You can further customize it by modifying HTML/CSS files, adding SSL certificates, or integrating a CMS like WordPress.
For any issues, check Apache logs:
sudo tail -f /var/log/apache2/access.log
Happy hosting! 🚀
Comments
Post a Comment