diff --git a/cloud/container/nginx-pwa/Dockerfile b/cloud/container/nginx-pwa/Dockerfile index ab20ef7..810deee 100644 --- a/cloud/container/nginx-pwa/Dockerfile +++ b/cloud/container/nginx-pwa/Dockerfile @@ -1,10 +1,12 @@ -ARG ALWATR_NGINX_VERSION=1.6.1-1.24-alpine +ARG ALWATR_NGINX_VERSION=1.7.0-1.24-alpine FROM ghcr.io/alimd/nginx:$ALWATR_NGINX_VERSION # Default environment for nginx template -ENV NGINX_OPEN_FILE_CACHE_INACTIVE=15m \ - NGINX_OPEN_FILE_CACHE_VALID=30d \ +ENV NGINX_OPEN_FILE_CACHE="max=1000 inactive=1h" \ + NGINX_OPEN_FILE_CACHE_VALID=1M \ + NGINX_OPEN_FILE_CACHE_MIN_USES=2 \ + NGINX_OUTPUT_BUFFERS="8 8k" \ NGINX_EXPIRES_DYNAMIC=epoch \ NGINX_EXPIRES_STATIC=max \ NGINX_EXPIRES_DEFAULT=epoch \ diff --git a/cloud/container/nginx/Dockerfile b/cloud/container/nginx/Dockerfile index 6650baf..d20f3a4 100644 --- a/cloud/container/nginx/Dockerfile +++ b/cloud/container/nginx/Dockerfile @@ -13,8 +13,10 @@ ENV NGINX_ACCESS_LOG=off \ NGINX_SENDFILE_MAX_CHUNK=2m \ NGINX_TCP_NOPUSH=on \ NGINX_TCP_NODELAY=on \ - NGINX_OPEN_FILE_CACHE_INACTIVE=15m \ - NGINX_OPEN_FILE_CACHE_VALID=30d \ + NGINX_OPEN_FILE_CACHE="max=1000 inactive=30m" \ + NGINX_OPEN_FILE_CACHE_VALID=1d \ + NGINX_OPEN_FILE_CACHE_MIN_USES=2 \ + NGINX_OUTPUT_BUFFERS="8 16k" \ NGINX_EXPIRES_DYNAMIC=max \ NGINX_EXPIRES_STATIC=max \ NGINX_EXPIRES_DEFAULT=max \ diff --git a/cloud/container/nginx/conf/templates/http.d/60-performance.conf.template b/cloud/container/nginx/conf/templates/http.d/60-performance.conf.template index f6222df..c9c58d1 100644 --- a/cloud/container/nginx/conf/templates/http.d/60-performance.conf.template +++ b/cloud/container/nginx/conf/templates/http.d/60-performance.conf.template @@ -8,15 +8,15 @@ ignore_invalid_headers on; # File Cache # Removed from the cache if it has not been accessed during `inactive` time -open_file_cache max=10000 inactive=$NGINX_OPEN_FILE_CACHE_INACTIVE; +open_file_cache $NGINX_OPEN_FILE_CACHE; # Sets a time after which open_file_cache elements should be validated. open_file_cache_valid $NGINX_OPEN_FILE_CACHE_VALID; # Sets the minimum number of file accesses during the period configured by the inactive parameter -open_file_cache_min_uses 1; +open_file_cache_min_uses $NGINX_OPEN_FILE_CACHE_MIN_USES; # Enables or disables caching of file lookup errors by open_file_cache. open_file_cache_errors on; # We need `open_log_file_cache` becouse https://serverfault.com/questions/547421 -open_log_file_cache max=10000 inactive=60s min_uses=2; +open_log_file_cache max=10000 inactive=30s valid=1m min_uses=2; # During which a keep-alive client connection will stay open on the server side. keepalive_timeout 300; @@ -25,3 +25,7 @@ keepalive_timeout 300; keepalive_requests 1000; types_hash_max_size 2048; + +# The output_buffers directive in nginx controls the size and number of buffers used to store the response data before it is sent to the client. +# Increasing the number of buffers can improve performance for clients with slow connections, while decreasing the number of buffers can reduce memory usage for clients with fast connections. +output_buffers $NGINX_OUTPUT_BUFFERS;