This project demonstrates how to build and deploy a static website (HTML, CSS, JS) to an Apache server on AWS EC2, using Jenkins as the CI/CD tool.
- ✅ Pulls source code from GitHub
- ✅ Jenkins automates deployment
- ✅ Apache serves the deployed website
- ✅ End-to-end flow: GitHub → Jenkins → App Server → Live Website
| Tool/Service | Role |
|---|---|
| Jenkins | CI/CD pipeline manager |
| GitHub | Source code repository |
| Apache2 | Web server on App EC2 |
| AWS EC2 | Hosts Jenkins and App server |
| Bash/SCP | For deployment script |
| SSH Keys | Secure communication between Jenkins & App server |
- One for Jenkins
- One for App server (Apache)
Open these ports in both:
- 22 – SSH
- 8080 – Jenkins UI (Jenkins server only)
- 80 – HTTP (App server only)
sudo apt update
sudo apt install openjdk-17-jdk -y
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee /etc/apt/trusted.gpg.d/jenkins.asc > /dev/null
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt update
sudo apt install jenkins -y
sudo systemctl start jenkins🔗 Access Jenkins:
http://<jenkins-public-ip>:8080Set up admin password and install suggested plugins.
sudo apt update
sudo apt install apache2 -y
sudo systemctl start apache2ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub ubuntu@<app-server-ip>This allows password-less deployment using scp.
On Jenkins server (as jenkins user):
#!/bin/bash
rm -rf /tmp/static-site
git clone https://github.com/itsiiie/test.git /tmp/static-site
scp -r /tmp/static-site/* ubuntu@<app-server-ip>:/var/www/htmlMake it executable:
chmod +x deploy.shType: Freestyle Project
GitHub URL: Your static site repo
Build Step: bash /path/to/deploy.sh
Trigger the build manually, or add GitHub webhook for automation
On App server:
sudo chmod -R 777 /var/www/html✔️ (This is temporary — use proper permission management for production)
Run:
ls /var/www/htmlOpen In Browser:
http://<app-server-ip>🎉 You should see your live website!
👨💻 Author Shashank Singh
DevOps Enthusiast | AWS | Jenkins | Ansible | Python
GitHub: https://github.com/itsiiie