Skip to content
Home
Dev Convert Generate Finance Calc Design Security Media

More categories

Productivity 23 SEO Tools 18 Network Tools 17 Text Tools 16 Education Tools 15 PDF Tools 11 Mockups 9

Learn and build

GuidesBlogAPI & MCPCheatsheetsChangelog All categories

Browse

439 tools · 15 categories

Start here

Popular tools New this week 11 All tools 439

Categories

Developer Tools 91 Converters 65 Calculators 32 Finance Tools 32 Generators 31 Media Tools 27 Design Tools 25 Security Tools 25 Productivity 23 SEO Tools 18 Network Tools 17 Text Tools 16 Education Tools 15 PDF Tools 11 Mockups 9

Learn and build

Guides Cheatsheets Blog REST API MCP server Changelog

No matches here.

Keep FindUtils free Sponsors fund new tools
  1. Cheatsheets
Guides Blog API & MCP
Sponsor
FindUtils
Sponsor
  1. Home
  2. Cheatsheets
  3. DevOps & Cloud
  4. Nginx Server

DevOps & Cloud · Cheatsheet

Nginx Server Cheatsheet

Server blocks, reverse proxy, SSL, load balancing, caching, and rate limiting

69 commands 9 sections

On this sheet

Service Management 12 Server Blocks (Virtual Hosts) 8 Location Blocks & Routing 8 Reverse Proxy 8 SSL / HTTPS 8 Load Balancing 6 Caching & Performance 10 Security & Headers 8 Sources 1

No entry matches that filter.

Service Management

  • sudo systemctl start nginx Start Nginx service
  • sudo systemctl stop nginx Stop Nginx service
  • sudo systemctl restart nginx Restart Nginx (drops connections)
  • sudo systemctl reload nginx Graceful reload without downtime
  • sudo systemctl enable nginx Enable Nginx on boot
  • sudo systemctl status nginx Check Nginx service status
  • nginx -t Test configuration syntax
  • nginx -T Test and dump full configuration
  • nginx -v Show Nginx version
  • nginx -V Show version and compile options
  • nginx -s reload Send reload signal to master process
  • nginx -s quit Graceful shutdown

Server Blocks (Virtual Hosts)

  • server { listen 80; } Define a server block on port 80
  • server_name example.com www.example.com; Set domain names for server block
  • root /var/www/html; Set document root directory
  • index index.html index.php; Set default index files
  • error_log /var/log/nginx/error.log; Set error log path
  • access_log /var/log/nginx/access.log; Set access log path
  • sudo ln -s /etc/nginx/sites-available/site /etc/nginx/sites-enabled/ Enable a site config
  • sudo rm /etc/nginx/sites-enabled/site Disable a site config

Location Blocks & Routing

  • location / { try_files $uri $uri/ =404; } Serve files or return 404
  • location /api/ { proxy_pass http://backend; } Proxy requests to backend
  • location ~ \.php$ { ... } Regex match for PHP files
  • location ^~ /images/ { ... } Prefix match (priority over regex)
  • location = /health { return 200; } Exact match for health check
  • try_files $uri $uri/ /index.php?$query_string; SPA/Laravel-style routing fallback
  • rewrite ^/old-path$ /new-path permanent; Permanent redirect (301)
  • return 301 https://$host$request_uri; Redirect HTTP to HTTPS

Reverse Proxy

  • proxy_pass http://localhost:3000; Forward to backend server
  • proxy_set_header Host $host; Pass original Host header
  • proxy_set_header X-Real-IP $remote_addr; Pass client real IP
  • proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; Pass forwarded-for chain
  • proxy_set_header X-Forwarded-Proto $scheme; Pass original protocol
  • proxy_http_version 1.1; Use HTTP/1.1 for keep-alive
  • proxy_set_header Upgrade $http_upgrade; Enable WebSocket upgrade
  • proxy_set_header Connection "upgrade"; WebSocket connection header

SSL / HTTPS

  • listen 443 ssl; Listen on HTTPS port
  • ssl_certificate /path/fullchain.pem; Set SSL certificate path
  • ssl_certificate_key /path/privkey.pem; Set SSL private key path
  • ssl_protocols TLSv1.2 TLSv1.3; Allow only modern TLS versions
  • ssl_prefer_server_ciphers on; Prefer server cipher order
  • ssl_session_cache shared:SSL:10m; Enable SSL session cache (10MB)
  • sudo certbot --nginx -d example.com Install Let's Encrypt certificate
  • add_header Strict-Transport-Security "max-age=31536000" always; Enable HSTS header

Load Balancing

  • upstream backend { server 127.0.0.1:3001; server 127.0.0.1:3002; } Define upstream server group
  • upstream backend { least_conn; ... } Use least connections algorithm
  • upstream backend { ip_hash; ... } Sticky sessions by client IP
  • server 127.0.0.1:3001 weight=3; Set server weight for balancing
  • server 127.0.0.1:3001 backup; Mark server as backup only
  • server 127.0.0.1:3001 max_fails=3 fail_timeout=30s; Set health check parameters

Caching & Performance

  • gzip on; Enable gzip compression
  • gzip_types text/css application/javascript; Set MIME types to compress
  • gzip_min_length 256; Minimum size to trigger compression
  • expires 30d; Set cache expiry to 30 days
  • add_header Cache-Control "public, no-transform"; Set cache control header
  • proxy_cache_path /tmp/cache levels=1:2 keys_zone=my_cache:10m; Define proxy cache zone
  • proxy_cache my_cache; Enable proxy caching
  • client_max_body_size 50m; Set max upload size to 50MB
  • sendfile on; Enable efficient file serving
  • worker_connections 1024; Max connections per worker

Security & Headers

  • deny all; Block access to location
  • allow 192.168.1.0/24; Allow access from IP range
  • limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s; Define rate limiting zone
  • limit_req zone=api burst=20 nodelay; Apply rate limit with burst
  • add_header X-Frame-Options "SAMEORIGIN"; Prevent clickjacking
  • add_header X-Content-Type-Options "nosniff"; Prevent MIME type sniffing
  • server_tokens off; Hide Nginx version in headers
  • location ~ /\.ht { deny all; } Block .htaccess files

Sources

  • https://nginx.org/en/docs/ nginx reference: directive contexts, HTTP routing, TLS, proxying, and limits.

Related cheatsheets

  • Docker Commands54 commands
  • Kubernetes Commands72 commands
  • Apache HTTP Server64 commands

From FindUtils

More to explore

Products and services from the team behind FindUtils.

Promote your tool
Featured product seeranks.com SeeRanks — transparent product discovery A public ranking board where paid placement is always labeled and every product keeps its earned position. View SeeRanks Public rank board #1 Sponsored #2 #3 #4 Paid placement is always labeled Free favicon tool emojifavicons.com Emoji Favicons Turn any emoji into a favicon with one HTML line. SVG, PNG or ICO, no sign-up. <link rel="icon" href=".../🦊.svg"> Create a favicon
FindUtils service findutils.com Articles for software tools A sourced article for your channels, or a sponsored FindUtils publication with editorial review. Compare packages Domain portfolio findutils.com Domain names for sale .com.dev.sh.app.io Unused names across dev tools, AI, PDF and commerce. Make an offer. Browse the list Playable ranking towerscore.io TowerScore — stack the skyline Play to climb, or buy a floor. Paid floors are labeled. Open TowerScore

Missing a tool you need?

Tell us what to build next. Most requests ship as a free browser tool, an API endpoint and an MCP tool.

Request a tool
FindUtils

Free, fast utilities. Most tools process your files in the browser; lookup tools say what they send, and pages load analytics and ads.

  • No sign-up for free tools
  • Most tools run in your browser
  • 369 tools on the REST API, 369 on MCP

Tools

DevelopersConvertPDFDesignSecurityAll tools →

Learn

GuidesBlogCheatsheetsChangelog

Build

REST APIMCP serverAPI referenceWorkflowsStatus

FindUtils

AboutLibraries we useSponsorRequest a toolDomains for saleContact
© 2026 FindUtils PrivacyTermsSitemap
Service status
FindUtils

Free, fast utilities that respect your data. Most tools run in your browser.

Build with it

REST APIMCP serverGuidesChangelog

FindUtils

AboutSponsorPrivacyContact
Theme
© 2026 FindUtils Terms
FindUtils
Guides Blog REST API MCP server Changelog

Categories

Developers 91 Convert 65 Calculate 32 Finance 32 Generate 31 Media 27
All 15 categories →

Keep it free

Sponsorship keeps every tool free and funds the new ones we ship each week.

Sponsor Back the project
Tools API Sponsor