How to Create a Free Web Server on AWS Using EC2 and Nginx (For Beginners)

Do you know you can make your own website server without buying a computer for it?
Amazon AWS gives you a free virtual computer (EC2) that runs on their big data centers.
Today, we’ll use that to create a web server and install Nginx (a program that shows websites).


Why Are We Doing This?

Imagine your computer at home is switched on and connected to the internet — you can share files or run a website from it. But it’s risky and costly.
Instead, AWS lets you rent a safe, powerful computer in the cloud for free (in the Free Tier).
We will:

  1. Create that cloud computer (EC2 instance).
  2. Install a web server program (Nginx).
  3. See our website running live.

Step-by-Step Guide

Step 1 → Log in to AWS and Go to EC2

Go to AWS Console.

Step 2 → Start a New Instance


Step 3 → Choose an Operating System


Step 4 → Choose the Size


Step 5 → Create or Choose a Key Pair


Step 6 → Network Settings


Step 7 → Storage


Step 8 → Add a Script to Install Nginx

We want our server ready when it starts — no extra typing later.
In Advanced details → User data, paste:

#!/bin/bash
yum install -y nginx
systemctl start nginx
systemctl enable nginx

Why?


Step 9 → Launch the Instance


Step 10 → See Your Website


What You Learned

Now you can tell your friends — “I have my own website server!” 🚀

Script details. (If you dont know )

1. What is ? #!/bin/bash

💡 Meaning:
“When you start this script, use the Bash program to read and execute it.”


2. yum install -y nginx

💡 Meaning:
“Install the Nginx web server without asking for confirmation.”


3. systemctl start nginx

💡 Meaning:
“Start running the Nginx web server right now.”


4. systemctl enable nginx

💡 Meaning:
“Make sure Nginx starts automatically every time the computer is turned on.”


In Simple Words:

Your script is saying:

  1. Use Bash to run these commands.
  2. Install Nginx automatically.
  3. Start Nginx immediately.
  4. Make Nginx start every time the server restarts.

Leave a Reply

Your email address will not be published. Required fields are marked *

0