Deploying and Securing a Live Website on AWS EC2
Hello, I’m Piyush Prasad, an aspiring DevOps and Cloud professional. This project showcases how I launched an AWS EC2 server, configured Nginx, connected a custom domain, enabled HTTPS with SSL, secured SSH using Fail2Ban, and resolved real deployment issues step by step.
About Me
I am an IT professional with practical experience in Linux systems, AWS cloud infrastructure, ticket management, and server administration. I enjoy building secure deployments, solving infrastructure issues, and learning modern DevOps practices through real projects.
Project Overview
The purpose of this project was to build and publish a live website using a custom domain. I configured the server environment, connected DNS records, secured SSH access, enabled HTTPS, and documented the errors I faced during setup along with the solutions I used to fix them.
Main Objectives
The key goals I completed during this deployment project.
Cloud Setup
- Launched an Ubuntu EC2 instance on AWS
- Connected to the server using SSH
- Prepared the server for web hosting
Web Hosting
- Installed and configured Nginx
- Hosted a static website in /var/www/html
- Mapped domain with server configuration
Security
- Configured Fail2Ban for SSH protection
- Allowed trusted IP in ignore list
- Enabled SSL using Let’s Encrypt
Setup Process From Start
A complete step-by-step summary of how I built and configured this project.
AWS EC2 Instance Creation
I launched a new Ubuntu-based AWS EC2 server and connected to it through SSH. This server became the main hosting environment for the website.
Nginx Installation and Verification
After logging in to the EC2 server, I installed Nginx and verified that the web server was running correctly by opening the server’s public IP in the browser.
Hosting Static Content
I used the default web root directory /var/www/html and replaced the default page with my own website content so the server could display a custom webpage.
DNS Record Configuration
I configured my domain by creating an A record pointing the domain to my EC2 public IP and a CNAME record pointing the www version to the main domain. This made the website accessible through a proper domain name instead of only an IP address.
Nginx Domain Mapping
I updated the Nginx server configuration and added the correct server_name values so that requests for my domain would be routed to the correct website content.
Fail2Ban Security Configuration
To secure SSH login, I installed Fail2Ban and created the jail.local configuration file. I added my trusted IP to the ignore list so I would not get blocked accidentally, and enabled SSH jail protection.
SSL Certificate Setup
Once the domain started resolving to the server, I installed Certbot and used Let’s Encrypt to generate an SSL certificate. This allowed the website to load securely over HTTPS.
Testing and Validation
After the final setup, I tested the website in the browser, checked Nginx status, verified Fail2Ban service, and confirmed that the website was live, secure, and accessible.
DNS Records I Configured
- A Record: Connected the main domain to the EC2 public IP
- CNAME Record: Connected www to the main domain
- Waited for DNS propagation to complete
- Verified that the domain was correctly resolving to the server
Security Configuration
- Installed and configured Fail2Ban
- Protected SSH from brute-force login attempts
- Added trusted IP under ignore list
- Enabled SSL certificate for HTTPS
- Used AWS Security Groups for port access control
Errors Faced and How I Solved Them
Real problems I encountered during setup and the solutions I applied.
Fail2Ban Service Error
When restarting Fail2Ban, the service failed because of an incorrect configuration in jail.local.
Domain Not Opening Initially
After adding the DNS records, the domain did not start working immediately.
Default Nginx Page Showing
At one stage, the browser showed the default Nginx page instead of my own content.
SSL Setup Readiness Issues
HTTPS requires the domain to correctly point to the server and port 443 to be allowed.
Final Outcome
This project was completed successfully. I was able to deploy a live website on AWS EC2, connect it with a domain name, secure it using Fail2Ban, and enable HTTPS with SSL. The final setup demonstrates practical knowledge of hosting, DNS management, server security, and troubleshooting.
Skills Demonstrated
- AWS EC2 server deployment
- Linux command-line administration
- Nginx installation and configuration
- DNS record setup and validation
- Fail2Ban SSH protection
- SSL and HTTPS configuration with Certbot
- Real-world troubleshooting and issue resolution
Conclusion
This project reflects my ability to work with cloud servers, configure web hosting, manage DNS, implement security best practices, and solve deployment issues in a practical environment. It represents an important step in my journey toward becoming a DevOps and Cloud Engineer.