~/CloudSetup.In

Nginx

Web Server nginx.conf ● stable

High-performance web server, reverse proxy, and load balancer.

01 Overview

Nginx serves static files, terminates TLS, and reverse-proxies traffic to application backends with low memory overhead. It's the default front door for a large share of production web infrastructure and Kubernetes ingress controllers.

→ official documentation

02 Installation

Pick a platform. Each step is copy-pasteable on its own.

01  Update package index
sudo apt update
02  Install Nginx
sudo apt install -y nginx
03  Enable and start the service
sudo systemctl enable --now nginx
04  Allow HTTP/HTTPS through the firewall
sudo ufw allow 'Nginx Full'
01  Install Nginx
sudo dnf install -y nginx
02  Enable and start the service
sudo systemctl enable --now nginx
03  Open the firewall
sudo firewall-cmd --permanent --add-service=http --add-service=https
sudo firewall-cmd --reload
01  Install via Homebrew
brew install nginx
02  Start the service
brew services start nginx
Note — commands assume sudo privileges and an up-to-date package index. Pin a specific version in production rather than tracking latest.

03 Install script

The steps above bundled into a single idempotent shell script for provisioning boxes unattended.

install-nginx.sh
Ubuntu/Debian target · safe to re-run · exits non-zero on failure
↓ download script

04 Cheatsheet

The commands reached for most often once Nginx is installed.

CommandWhat it does
sudo nginx -tTest config syntax before reloading
sudo systemctl reload nginxReload config without dropping connections
sudo systemctl status nginxCheck service status
tail -f /var/log/nginx/access.logFollow access logs
tail -f /var/log/nginx/error.logFollow error logs
nginx -VShow compiled-in modules and build flags
proxy_pass http://backend;Forward requests to an upstream in a server block