Upstream health proxy pass nginx
Round-robin upstream with backup and keepalive connections
upstream backend {
server 10.0.0.1:8080;
server 10.0.0.2:8080 backup;
keepalive 32;
}
more nginx
all 15 commands →
Enable gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript;
gzip_min_length 1024;
gzip_comp_level 6;
Return JSON error response
error_page 429 /429.json;
location = /429.json {
default_type application/json;
return 429 '{"error":"rate_limited"}';
}
Force HTTPS redirect
server {
listen 80;
return 301 https://$host$request_uri;
}
Show active connections
curl -s http://localhost/stub_status
Block IP range
deny 192.168.1.0/24;
deny 10.0.0.1;
allow all;