Включить gzip nginx
Сжимать текстовые ответы ≥1KB на уровне 6
gzip on;
gzip_types text/plain text/css application/json application/javascript;
gzip_min_length 1024;
gzip_comp_level 6;
more nginx
all 15 commands →
JSON ответ об ошибке
error_page 429 /429.json;
location = /429.json {
default_type application/json;
return 429 '{"error":"rate_limited"}';
}
Редирект на HTTPS
server {
listen 80;
return 301 https://$host$request_uri;
}
Активные соединения
curl -s http://localhost/stub_status
Заблокировать диапазон IP
deny 192.168.1.0/24;
deny 10.0.0.1;
allow all;
Проксировать WebSocket
location /ws/ {
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
}