New configuration of cache

This commit is contained in:
Artur Kuś 2025-08-18 18:52:06 +02:00
parent 0763532809
commit 0615e7ea51
2 changed files with 11 additions and 17 deletions

View File

@ -22,10 +22,16 @@ services:
# Cache
- type: tmpfs
target: /var/cache/nginx
target: /var/cache/nginx2GB
tmpfs:
size: 2147483648 # 2GB w bajtach
mode: 1777
- type: tmpfs
target: /var/cache/nginx05GB
tmpfs:
size: 547483648 # 512 kb w bajtach
mode: 1777
# Certyfikaty SSL
- ${DOCKER_DATA}/letsencrypt:/letsencrypt:rw

View File

@ -2,8 +2,8 @@
limit_req_zone $binary_remote_addr zone=ip_limit:10m rate=2r/s;
# Konfiguracja cache (nowa część)
proxy_cache_path /var/cache/nginx/static levels=1:2 keys_zone=STATIC:50m inactive=24h max_size=500m use_temp_path=off;
proxy_cache_path /var/cache/nginx/media levels=1:2 keys_zone=MEDIA:100m inactive=7d max_size=2g use_temp_path=off;
proxy_cache_path /var/cache/nginx05GB levels=1:2 keys_zone=STATIC:50m inactive=24h max_size=500m use_temp_path=off;
proxy_cache_path /var/cache/nginx2GB levels=1:2 keys_zone=MEDIA:100m inactive=7d max_size=2g use_temp_path=off;
server {
listen 443 ssl;
@ -46,7 +46,8 @@
proxy_cache_valid 200 30d;
proxy_cache_use_stale error timeout updating;
proxy_cache_lock on;
add_header X-Cache-Status $upstream_cache_status;
proxy_cache_key "$scheme$host$request_uri";
add_header X-Cache-Status $upstream_cache_status always;
expires 1y;
access_log off;
@ -54,17 +55,4 @@
proxy_hide_header Set-Cookie;
}
location ~* \.(css|js)$ {
proxy_pass http://arti24-container:3000;
proxy_cache STATIC;
proxy_cache_valid 200 7d;
proxy_cache_use_stale error timeout updating;
proxy_cache_lock on;
add_header X-Cache-Status $upstream_cache_status;
expires 1y;
access_log off;
proxy_ignore_headers Cache-Control Set-Cookie;
proxy_hide_header Set-Cookie;
}
}