asset handling cleanup

This commit is contained in:
robert dennis
2026-10-06 12:20:52 -04:00
parent e1a1483217
commit e284c381aa
7 changed files with 178 additions and 24 deletions
+4
View File
@@ -17,6 +17,10 @@ server {
}
location ^~ /assets/ {
location ~ /\. {
deny all;
}
try_files $uri =404;
}
+4
View File
@@ -49,6 +49,10 @@ server {
}
location ^~ /assets/ {
location ~ /\. {
deny all;
}
try_files $uri =404;
}
+18
View File
@@ -64,6 +64,24 @@ if [ ! -f /etc/nginx/http.d/panel.conf ]; then
fi
mv /etc/nginx/http.d/panel.conf.tmp /etc/nginx/http.d/panel.conf
fi
# Configs persisted by older images hand files under /assets/ to PHP-FPM; serve that tree as static files only.
if ! grep -qF 'location ^~ /assets/' /etc/nginx/http.d/panel.conf; then
ASSETS_BLOCK=$(cat <<'EOF'
location ^~ /assets/ {
location ~ /\. {
deny all;
}
try_files $uri =404;
}
EOF
) awk '!done && index($0, "location ~ \\.php$") { print ENVIRON["ASSETS_BLOCK"]; print ""; done = 1 } { print }' \
/etc/nginx/http.d/panel.conf > /etc/nginx/http.d/panel.conf.tmp
mv /etc/nginx/http.d/panel.conf.tmp /etc/nginx/http.d/panel.conf
grep -qF 'location ^~ /assets/' /etc/nginx/http.d/panel.conf \
|| echo 'warning: /etc/nginx/http.d/panel.conf has no PHP location; add the /assets/ block from .github/docker/default.conf by hand.' >&2
fi
rm -f /etc/nginx/http.d/default.conf
cp .github/docker/health.conf /etc/nginx/http.d/health.conf