+ proxy_cache_path and others
This commit is contained in:
parent
aa0fbb55f1
commit
30b0e10f5d
|
|
@ -1,41 +1,34 @@
|
||||||
|
# Limitowanie requestów (pozostawiamy bez zmian)
|
||||||
limit_req_zone $binary_remote_addr zone=ip_limit:10m rate=2r/s;
|
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;
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
|
|
||||||
server_name www.bodypainter.eu;
|
server_name www.bodypainter.eu;
|
||||||
|
|
||||||
ssl_protocols TLSv1.2 TLSv1.3;
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
|
||||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||||
|
|
||||||
ssl_certificate /letsencrypt/live/bodypainter.eu/fullchain.pem;
|
ssl_certificate /letsencrypt/live/bodypainter.eu/fullchain.pem;
|
||||||
ssl_certificate_key /letsencrypt/live/bodypainter.eu/privkey.pem;
|
ssl_certificate_key /letsencrypt/live/bodypainter.eu/privkey.pem;
|
||||||
|
|
||||||
return 301 https://bodypainter.eu$request_uri;
|
return 301 https://bodypainter.eu$request_uri;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
server_name bodypainter.eu;
|
server_name bodypainter.eu;
|
||||||
|
|
||||||
server_tokens off;
|
server_tokens off;
|
||||||
|
|
||||||
ssl_certificate /letsencrypt/live/bodypainter.eu/fullchain.pem;
|
|
||||||
ssl_certificate_key /letsencrypt/live/bodypainter.eu/privkey.pem;
|
|
||||||
|
|
||||||
ssl_protocols TLSv1.2 TLSv1.3;
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||||
|
ssl_certificate /letsencrypt/live/bodypainter.eu/fullchain.pem;
|
||||||
|
ssl_certificate_key /letsencrypt/live/bodypainter.eu/privkey.pem;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
|
|
||||||
# Ograniczenie liczby żądań
|
|
||||||
limit_req zone=ip_limit burst=20 nodelay;
|
limit_req zone=ip_limit burst=20 nodelay;
|
||||||
|
|
||||||
proxy_pass http://arti24-container:3000;
|
proxy_pass http://arti24-container:3000;
|
||||||
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
|
@ -46,4 +39,32 @@ server {
|
||||||
proxy_set_header X-Forwarded-Port $server_port;
|
proxy_set_header X-Forwarded-Port $server_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Nowe lokacje dla cache'owania
|
||||||
|
location ~* \.(jpg|jpeg|png|gif|ico|webp)$ {
|
||||||
|
proxy_pass http://arti24-container:3000;
|
||||||
|
proxy_cache MEDIA;
|
||||||
|
proxy_cache_valid 200 30d;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue