AWS EC2 • Nginx • DNS • SSL • Fail2Ban

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.

Project Goal
Live Secure Website
Hosted On
AWS EC2 Ubuntu
Web Server
Nginx
Security Stack
Fail2Ban + SSL

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.

AWS Linux Nginx DNS Fail2Ban SSL

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.

1

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.

2

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.

3

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.

4

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.

5

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.

6

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.

7

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.

8

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.

Solution: I checked the file, removed the duplicate [DEFAULT] section, placed the settings in the correct location, and then restarted the service successfully.

Domain Not Opening Initially

After adding the DNS records, the domain did not start working immediately.

Solution: I verified the A and CNAME records, confirmed the EC2 IP, and waited for DNS propagation. After propagation completed, the domain started resolving correctly.

Default Nginx Page Showing

At one stage, the browser showed the default Nginx page instead of my own content.

Solution: I replaced the default index.html file inside /var/www/html and confirmed the Nginx root path and server name configuration were correct.

SSL Setup Readiness Issues

HTTPS requires the domain to correctly point to the server and port 443 to be allowed.

Solution: I ensured the domain was resolving properly, kept Nginx active, allowed HTTPS access in AWS Security Groups, and then ran Certbot successfully.

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.