Setting Up an Nginx Server on AWS EC2


Introduction
This article guides you in installing and configuring an Nginx on a server. Here we used an Elastic compute instance. Setting up an Nginx server on AWS EC2 can be challenging due to SSH and firewall issues.
Here’s how I tackled them.
Launch EC2 Instance – Created an instance with the appropriate AMI and security settings.
Install Nginx – Used
sudo apt update && sudo apt install nginx
.Start & Enable Nginx – Ran
sudo systemctl start nginx && sudo systemctl enable nginx
.Configure Security Group – Allowed inbound traffic on ports
22
(SSH) and80
(HTTP).Firewall Configuration – Installed
firewalld
and allowed necessary ports
Challenges & Solutions
SSH Connection Issues: Fixed by verifying the key pair and using the right username.
Nginx Page Not Loading: Solved by allowing HTTP traffic in security groups and configuring the firewall.
HTML Site Not Rendering: Resolved after installing and starting the server by ensuring HTTP traffic was allowed in security groups and properly configuring the firewall.
This experience improved my DevOps Hand’s on skill and here are resources i referenced
Subscribe to my newsletter
Read articles from Louis Echefu directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Louis Echefu
Louis Echefu
I am a Software Engineer currently learning about the Cloud (DevOps)