Better Nginx config.

This commit is contained in:
Mario Zechner 2023-05-30 14:32:20 +02:00
parent e05e5a62a3
commit 6a5ca97b65
2 changed files with 9 additions and 18 deletions

View File

@ -1,16 +1,15 @@
user nginx; user nginx;
worker_processes auto; worker_processes auto;
worker_rlimit_nofile 100000;
error_log /var/log/nginx/error.log notice; error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid; pid /var/run/nginx.pid;
events { events {
worker_connections 1024; worker_connections 4096;
multi_accept on;
} }
http { http {
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
@ -26,10 +25,12 @@ http {
POST $binary_remote_addr; POST $binary_remote_addr;
} }
limit_req_zone $binary_remote_addr zone=one_per_second:20m rate=1r/s; gzip on;
limit_req_zone $binary_remote_addr zone=one_per_minute:20m rate=1r/m; gzip_vary on;
gzip_comp_level 6;
keepalive_timeout 65; gzip_min_length 1000;
gzip_proxied any;
gzip_types text/plain application/x-javascript application/javascript text/xml text/css application/xml application/json;
include /etc/nginx/conf.d/*.conf; include /etc/nginx/conf.d/*.conf;
} }

View File

@ -12,16 +12,6 @@ server {
real_ip_recursive on; real_ip_recursive on;
set_real_ip_from 0.0.0.0/0; set_real_ip_from 0.0.0.0/0;
sendfile on;
sendfile_max_chunk 1m;
tcp_nopush on;
tcp_nodelay on;
gzip on;
gzip_comp_level 4;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/x-javascript application/javascript text/xml text/css application/xml application/json;
location / { location / {
} }