Deploying a simple HTML on Nginx using AWS

This blog post documents my experience setting up a web server using Nginx, from spinning up an EC2 instance to configuring the server to serve a custom HTML page. It details the process, the challenges I faced, and the valuable lessons I learned.


This content originally appeared on DEV Community and was authored by Mwanza Simi

This blog post documents my experience setting up a web server using Nginx, from spinning up an EC2 instance to configuring the server to serve a custom HTML page. It details the process, the challenges I faced, and the valuable lessons I learned.

EC2 and Nginx Installation:

I began by launching an Amazon EC2 instance. I chose an Amazon Linux 2 AMI, as it's a stable and readily available option. I selected a t2.micro instance for this simple setup, as it fits within the free tier. Once the instance was running, I connected to it via SSH.

The next step was installing Nginx. Since I was using Amazon Linux 2, I used the yum package manager:

sudo yum update -y  
sudo yum install nginx -y 
sudo systemctl start nginx 
sudo systemctl enable nginx 

After installation, I verified that Nginx was running by accessing the instance's public IP address in my browser. The default Nginx welcome page confirmed a successful installation.

Creating the Custom Web Page:

With Nginx up and running, it was time to create the custom HTML page. I created a directory to hold my website's files:

sudo mkdir -p /var/www/html

Then, I created the index.html file within this directory:

sudo nano /var/www/html/index.html

Inside index.html, I added the following content, my name:


<!DOCTYPE html>
<html>
<head>
    <title>Welcome</title>
</head>
<body>
    <h1>Welcome to DevOps Stage 0 - [Your Name]/[SlackName]</h1>
</body>
</html>

Challenges and Learning Opportunities:

While the process was relatively straightforward, I encountered a challenge

Firewall Configuration: Initially, I couldn't access my webpage even after Nginx was running. I realized that the EC2 instance's security group (firewall) wasn't configured to allow inbound traffic on port 80 (HTTP). This taught me the importance of properly configuring security groups to allow access to the necessary ports. I learned how to add a rule to the security group to open port 80.

Setting up a web server with Nginx on EC2 was a valuable learning experience. I gained practical knowledge of EC2 instances, Nginx installation, and basic web server configuration. The challenges I faced reinforced the importance of understanding these fundamental concepts. I am excited to continue exploring more advanced DevOps tools and skills.

For more check out HNG internship, They offer resources for hiring various tech experts, including:

DevOps Engineers: https://hng.tech/hire/devops-engineers
Cloud Engineers: https://hng.tech/hire/cloud-engineers
Site Reliability Engineers: https://hng.tech/hire/site-reliability-engineers
Platform Engineers: https://hng.tech/hire/platform-engineers
Infrastructure Engineers: https://hng.tech/hire/infrastructure-engineers
Kubernetes Specialists: https://hng.tech/hire/kubernetes-specialists
AWS Solutions Architects: https://hng.tech/hire/aws-solutions-architects
Azure DevOps Engineers: https://hng.tech/hire/azure-devops-engineers
Google Cloud Engineers: https://hng.tech/hire/google-cloud-engineers
CI/CD Pipeline Engineers: https://hng.tech/hire/ci-cd-pipeline-engineers
Monitoring/Observability Engineers: https://hng.tech/hire/monitoring-observability-engineers
Automation Engineers: https://hng.tech/hire/automation-engineers
Docker Specialists: https://hng.tech/hire/docker-specialists
Linux Developers: https://hng.tech/hire/linux-developers
PostgreSQL Developers: https://hng.tech/hire/postgresql-developers


This content originally appeared on DEV Community and was authored by Mwanza Simi


Print Share Comment Cite Upload Translate Updates
APA

Mwanza Simi | Sciencx (2025-01-29T17:19:19+00:00) Deploying a simple HTML on Nginx using AWS. Retrieved from https://www.scien.cx/2025/01/29/deploying-a-simple-html-on-nginx-using-aws/

MLA
" » Deploying a simple HTML on Nginx using AWS." Mwanza Simi | Sciencx - Wednesday January 29, 2025, https://www.scien.cx/2025/01/29/deploying-a-simple-html-on-nginx-using-aws/
HARVARD
Mwanza Simi | Sciencx Wednesday January 29, 2025 » Deploying a simple HTML on Nginx using AWS., viewed ,<https://www.scien.cx/2025/01/29/deploying-a-simple-html-on-nginx-using-aws/>
VANCOUVER
Mwanza Simi | Sciencx - » Deploying a simple HTML on Nginx using AWS. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/01/29/deploying-a-simple-html-on-nginx-using-aws/
CHICAGO
" » Deploying a simple HTML on Nginx using AWS." Mwanza Simi | Sciencx - Accessed . https://www.scien.cx/2025/01/29/deploying-a-simple-html-on-nginx-using-aws/
IEEE
" » Deploying a simple HTML on Nginx using AWS." Mwanza Simi | Sciencx [Online]. Available: https://www.scien.cx/2025/01/29/deploying-a-simple-html-on-nginx-using-aws/. [Accessed: ]
rf:citation
» Deploying a simple HTML on Nginx using AWS | Mwanza Simi | Sciencx | https://www.scien.cx/2025/01/29/deploying-a-simple-html-on-nginx-using-aws/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.