# Contrainte : les directives `limit_req_zone` ne sont valides que dans le bloc `http`. # Les `location` de conf.d/enervision.conf s'y réfèrent par nom, `api` et `auth`. worker_processes auto; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; server_tokens off; log_format enervision '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent $request_time ' '"$http_referer" "$http_user_agent"'; access_log /var/log/nginx/access.log enervision; sendfile on; tcp_nopush on; keepalive_timeout 65; client_max_body_size 2m; gzip on; gzip_vary on; gzip_min_length 1024; gzip_proxied any; gzip_types application/javascript application/json application/xml image/svg+xml text/css text/plain; limit_req_zone $binary_remote_addr zone=api:10m rate=20r/s; limit_req_zone $binary_remote_addr zone=auth:10m rate=30r/m; limit_req_status 429; include /etc/nginx/conf.d/*.conf; }