nginx commands
15 commands, each with a one-line explanation. Click a command to copy it, or its title for details.
Commands 15 shown
-
nginx -tValidate nginx.conf without reloading
-
nginx -s reloadGracefully reload config — zero connection drop
-
nginx -V 2>&1 | tr ' ' '\n' | grep moduleList all built-in and dynamic modules in the binary
-
tail -f /var/log/nginx/access.log | awk '{print $1, $7, $9, $10}'Stream IP, path, status code, and response size
-
awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rnFrequency of each HTTP status code in access log
-
awk '{print $7}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -10Most popular request paths from access log
-
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -10Top 10 client IPs hitting the server
-
limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s; limit_req zone=api burst=20 nodelay;Limit to 10 req/s per IP with burst of 20 (add to http/server block)
-
upstream backend { server 10.0.0.1:8080; server 10.0.0.2:8080 backup; keepalive 32; }Round-robin upstream with backup and keepalive connections
-
gzip on; gzip_types text/plain text/css application/json application/javascript; gzip_min_length 1024; gzip_comp_level 6;Compress text responses ≥1KB at level 6
-
error_page 429 /429.json; location = /429.json { default_type application/json; return 429 '{"error":"rate_limited"}'; }Custom JSON body for rate-limit or error responses
-
server { listen 80; return 301 https://$host$request_uri; }Permanent redirect all HTTP traffic to HTTPS
-
curl -s http://localhost/stub_statusBuilt-in nginx status page: active, reading, writing, waiting
-
deny 192.168.1.0/24; deny 10.0.0.1; allow all;Block a subnet and specific IP in nginx location/server block
-
location /ws/ { proxy_pass http://backend; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; }WebSocket proxy with required Upgrade headers
no commands match — try a different search