This commit is contained in:
u00lipp
2025-10-30 11:00:53 +01:00
parent 399bf44394
commit 13d912738d
+6 -1
View File
@@ -16,6 +16,7 @@ fi
if [ "$ENABLE_BASIC_AUTH" = "true" ]; then
echo "[entrypoint] Enabling basic authentication..."
if [ -f /etc/nginx/htpasswd ]; then
# Use sed to append basic auth directives inside the location block
sed -i '/location \/ {/a \\t\tauth_basic "Restricted Content";\n\t\tauth_basic_user_file /etc/nginx/htpasswd;' /etc/nginx/http.d/default.conf
else
echo "[entrypoint] ERROR: htpasswd file not found at /etc/nginx/htpasswd" >&2
@@ -26,7 +27,11 @@ else
fi
# Test nginx configuration
nginx -t || { echo "[entrypoint] nginx config test failed" >&2; cat /var/log/nginx/error.log || true; exit 1; }
if ! nginx -t; then
echo "[entrypoint] nginx config test failed" >&2
cat /var/log/nginx/error.log || true
exit 1
fi
# Clear Laravel caches
php artisan config:clear