Setting Up an Nginx Server on AWS EC2

Louis EchefuLouis Echefu
1 min read

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.

  1. Launch EC2 Instance – Created an instance with the appropriate AMI and security settings.

  2. Install Nginx – Used sudo apt update && sudo apt install nginx.

  3. Start & Enable Nginx – Ran sudo systemctl start nginx && sudo systemctl enable nginx.

  4. Configure Security Group – Allowed inbound traffic on ports 22 (SSH) and 80 (HTTP).

  5. Firewall Configuration – Installed firewalld and allowed necessary ports

Challenges & Solutions

  1. SSH Connection Issues: Fixed by verifying the key pair and using the right username.

  2. Nginx Page Not Loading: Solved by allowing HTTP traffic in security groups and configuring the firewall.

  3. 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

  1. https://hng.tech/hire/devops-engineers

  2. https://hng.tech/hire/cloud-engineers

0
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)