How to Install and Configure Nginx on Linux Server
Introduction
Nginx is a high-performance web server used for hosting websites, APIs, and reverse proxies.
Prerequisites
- Linux server (Ubuntu 20.04+)
- Sudo or root access
Step 1 — Update System
sudo apt update && sudo apt upgrade -y
Step 2 — Install Nginx
sudo apt install nginx -y
Step 3 — Start and Enable Nginx
sudo systemctl start nginx
sudo systemctl enable nginx
Step 4 — Firewall Configuration
sudo ufw allow 'Nginx Full'
sudo ufw reload
Step 5 — Verify Installation
Open browser:
http://SERVER_IP
Step 6 — Basic Server Block
server {
listen 80;
server_name example.com;
root /var/www/example.com;
index index.html;
}
Conclusion
Nginx is installed and ready for production use.
Author
Marquefactory DevOps Team
