Nginx is a high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. Known for its stability, rich feature set, simple configuration, and low resource consumption, Nginx powers a significant portion of the busiest websites on the internet. It excels as a web server, load balancer, reverse proxy, and HTTP cache.
📑 Table of Contents
Key Features
- Event-Driven Architecture – Handles thousands of concurrent connections efficiently
- Reverse Proxy – Proxy HTTP, TCP, and UDP traffic
- Load Balancing – Distribute traffic across multiple backends
- SSL/TLS Termination – Handle HTTPS encryption
- Static Content – Serve static files with high performance
- Caching – Built-in content caching
- HTTP/2 and HTTP/3 – Modern protocol support
Installation
# Debian/Ubuntu
sudo apt install nginx
# RHEL/CentOS/Fedora
sudo dnf install nginx
# Arch Linux
sudo pacman -S nginx
Basic Configuration
# /etc/nginx/sites-available/example.conf
server {
listen 80;
server_name example.com;
root /var/www/html;
location / {
try_files $uri $uri/ =404;
}
}
# Reverse proxy configuration
server {
listen 80;
server_name api.example.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Use Cases
Nginx is ideal for web serving, reverse proxying, load balancing, API gateway, media streaming, and as a high-performance frontend for application servers.
Was this article helpful?