A step-by-step walkthrough of deploying a web app using Git, Apache, and Linux commands.

Introduction
As I continue my journey into Cloud Computing and DevOps, I believe it is crucial to understand the manual processes before automating them. Today, I decided to test my core skills by taking a raw static website and hosting it on the cloud from scratch.
In this post, I’ll walk you through how I set up an AWS EC2 instance, configured the Apache web server, and deployed my code using Git.
The Tech Stack
AWS EC2: For our virtual server.
Git/GitHub: For version control.
Apache (httpd): To serve our web files.
Linux: The operating system where the magic happens.
Step 1: Version Control Setup
First, I needed a repository to hold my source code. I created a simple static HTML web page locally.
Created a new empty repository on GitHub.
Initialized Git locally and pushed my code.
Bash
git init
git add .
git commit -m "Initial commit for static site"
git branch -M main
git remote add origin <your-repo-link>
git push -u origin main
Step 2: Provisioning the Infrastructure
Next, I headed to the AWS Console to launch a server.
Service: EC2 (Elastic Compute Cloud)
AMI: RHEL (You can also use Ubuntu)
Instance Type: t2.micro (Free tier eligible!)
Security Group: Opened port 22 (SSH) for access and port 80 (HTTP) so the world can see the website.
Step 3: Setting Up the Environment
Once the instance was running, I SSH’d into it. The first order of business was to install the web server.
Bash
# Update the package repository
sudo yum update -y
# Install the Apache web server
sudo yum install httpd -y
After installation, I had to make sure the service was running and would restart automatically if the server rebooted.
Bash
# Start the service
sudo systemctl start httpd
# Enable it to start on boot
sudo systemctl enable httpd
Step 4: Deploying the Application
With the server ready, I needed to get my code onto the machine. I installed Git on the instance and cloned my repository.
Bash
sudo yum install git -y
git clone <your-repo-link>
The Apache web server looks for files in the /var/www/html directory by default. I moved my web app files from the cloned repository folder into this directory.
Bash
sudo mv my-web-app/* /var/www/html/
Step 5: Verification
The final test! I copied the Public IP address of my EC2 instance and pasted it into my browser.
🎉 Success: My static web page loaded up perfectly.
What I Learned
This mini-project was a great refresher on the fundamental relationship between source code, servers, and deployment directories.
Linux Skills: Navigating file systems and managing services with systemctl.
Networking: Understanding Security Groups and opening Port 80.
Troubleshooting: Verifying file permissions in /var/www/html.
While tools like Terraform and Docker are powerful, there is something satisfying about doing it the “hard way” to truly understand what is happening under the hood.
Thanks for reading! Have you tried hosting your own site on EC2? Let me know in the comments.
Linkedin: https://www.linkedin.com/in/dasari-jayanth-b32ab9367/
Top comments (0)