Update varnish config

This commit is contained in:
weidenwiesel
2026-02-02 15:09:30 +01:00
parent 894c4e68cc
commit 0f86542660
3 changed files with 13 additions and 8 deletions
+5 -5
View File
@@ -395,17 +395,17 @@ services:
container_name: invidious-cache
restart: unless-stopped
cpus: 2
mem_limit: "1024m"
memswap_limit: "1024m"
mem_limit: "512m"
memswap_limit: "512m"
image: varnish:latest
user: 10043:10043 # Put uid/gid of your invidious user here
volumes:
- /srv/invidious/varnish:/var/lib/varnish
command: "-a :6081 -T localhost:6082 -f /var/lib/varnish/default.vcl -s file,/var/lib/varnish/varnish_storage.bin,16G -p cli_timeout=15"
command: "-a :6081 -T localhost:6082 -f /var/lib/varnish/default.vcl -s file,/var/lib/varnish/varnish_storage.bin,32G -s Transient=malloc,128m -p cli_timeout=15"
ulimits:
memlock:
soft: 1073741824
hard: 1073741824
soft: 536870912
hard: 536870912
networks:
invidious_proxy:
ipv4_address: 192.42.6.3
+7 -2
View File
@@ -4,14 +4,14 @@ backend invidious_service {
.host = "192.42.6.2";
.port = "3000";
.connect_timeout = 5s;
.first_byte_timeout = 15s;
.first_byte_timeout = 5s;
.between_bytes_timeout = 2s;
}
sub vcl_recv {
set req.backend_hint = invidious_service;
if (req.url ~ "(?i)\.(png|gif|jpg|jpeg|svg)$") {
if (req.url ~ "(?i)\.(css|js|png|gif|jpg|jpeg|svg|woff|woff2)$") {
unset req.http.Cookie;
}
@@ -29,7 +29,12 @@ sub vcl_hash {
}
sub vcl_backend_response {
set beresp.storage = storage.disk;
if (bereq.url ~ "(?i)\.(png|gif|jpg|jpeg|svg)$") {
unset beresp.http.Set-Cookie;
set beresp.ttl = 3d;
}
if (bereq.url ~ "(?i)\.(css|js|woff|woff2)$") {
unset beresp.http.Set-Cookie;
set beresp.ttl = 7d;
}
+1 -1
View File
@@ -247,7 +247,7 @@ server {
}
# Varnish cache
location ~^(/vi/|/ggpht/) {
location ~^(/vi/|/ggpht/|/js/|/css/|/videojs/|/fonts/) {
proxy_pass http://varnish_invidious;
proxy_set_header Host $host;