fix: RateLimit permission denied — code + deploy scripts

RateLimit.php:
- Silence mkdir() with @ operator
- Guard file_put_contents with is_writable() check (graceful degrade)

scripts/deploy-server.sh + setup-server.sh:
- mkdir -p storage/cache/rate_limit on every deploy
- chown www-data:posterg + chmod 2775 on storage/cache/
  so php-fpm can always write rate limit files
This commit is contained in:
Pontoporeia
2026-04-06 16:40:55 +02:00
parent 756ddb5765
commit e6960f0c9c

View File

@@ -25,7 +25,7 @@ printf "==================================\n\n"
# ── Step 1: Permissions ───────────────────────────────────────────────────────
printf "📋 Step 1: Fixing file permissions...\n"
printf "--------------------------------------\n"
echo "--------------------------------------"
chown -R www-data:posterg /var/www/posterg/
ok "Ownership: www-data:posterg"
@@ -50,7 +50,7 @@ ok "Cache dirs: created and owned by www-data:posterg"
# ── Step 2: Nginx config ──────────────────────────────────────────────────────
printf "\n📋 Step 2: Deploying nginx configuration...\n"
printf "--------------------------------------------\n"
echo "--------------------------------------------"
if [ ! -f "/tmp/posterg.conf" ]; then
err "/tmp/posterg.conf not found — run: just deploy-nginx"
@@ -73,7 +73,7 @@ fi
# ── Step 3: Validate ──────────────────────────────────────────────────────────
printf "\n📋 Step 3: Testing nginx configuration...\n"
printf "------------------------------------------\n"
echo "------------------------------------------"
if nginx -t 2>&1; then
ok "Nginx configuration is valid"