Day8-devops-challange
Deploy Your First Web Server with Nginx

๐ What is Nginx?
Nginx is a high-performance open-source web server used to:
Serve static websites
Act as a reverse proxy
Load balance traffic
Handle high-traffic applications
It is fast, lightweight, and widely used in production environments.
Many big companies use Nginx in their infrastructure.
๐ฅ๏ธ What You Need Before Starting
A Linux server (Ubuntu recommended)
Basic terminal knowledge
SSH access to your server
Internet connection
You can use:
AWS EC2
Azure VM
Google Cloud VM
Or even VirtualBox locally
๐งฑ Step 1: Launch a Server (Ubuntu Example)
If using cloud (AWS EC2):
Launch Ubuntu instance
Allow inbound rule:
Port 22 (SSH)
Port 80 (HTTP)
๐ฆ Step 2: Update the Server
Always update packages first:
sudo apt update sudo apt upgrade -y๐ฅ Step 3: Install Nginx
sudo apt install nginx -YCheck if it is running:
sudo systemctl status nginxIf running, youโll see:
Active: active (running) โ๐ Step 4: Allow Firewall (If Enabled)
sudo ufw allow 'Nginx Full'Check status:
sudo ufw status๐ Step 5: Access Your Web Server
Open your browser:
http://your-server-ipYou should see the default Welcome to Nginx! page.
๐ Congratulations! Your web server is live.
๐ Step 6: Deploy Your Own Website
Default Nginx website folder:
/var/www/html
Move into the directory:
cd /var/www/html
Remove default file:
sudo rm index.nginx-debian.html
Create your own website:
sudo nano index.html
Paste this:
<!DOCTYPE html>
<html>
<head>
<title>My First Web Server</title>
</head>
<body>
<h1>Hello DevOps World ๐</h1>
<p>This website is deployed using Nginx!</p>
</body>
</html>
Save and exit.
Now refresh browser ๐
๐ง How Nginx Works (Simple Flow)
User Browser
โ
Internet
โ
Server (Port 80)
โ
Nginx
โ
Website Files (/var/www/html)
โ
Response to User
โ๏ธ Important Nginx Commands
Start Nginx:
sudo systemctl start nginx
Stop Nginx:
sudo systemctl stop nginx
Restart Nginx:
sudo systemctl restart nginx
Reload Configuration:
sudo systemctl reload nginx

๐๏ธ Nginx Folder Structure
Main config file:
/etc/nginx/nginx.conf
Site config folder:
/etc/nginx/sites-available
/etc/nginx/sites-enabled
Website root:
/var/www/html
๐ Why Nginx is Popular? High performance
Handles thousands of connections
Low memory usage
Great for reverse proxy
Easy configuration
Perfect for microservices & DevOps
๐ Real-World Use
Nginx is used by:
Netflix
WordPress
Airbnb
It is a core component in many DevOps pipelines.