mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
rename posterg → xamxam throughout: nginx conf, scripts, PHP source, docs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
# Deploy production nginx configuration for Post-ERG
|
||||
# Fixes permissions and installs /tmp/posterg.conf into nginx sites-available.
|
||||
# Deploy production nginx configuration for XAMXAM
|
||||
# Fixes permissions and installs /tmp/xamxam.conf into nginx sites-available.
|
||||
#
|
||||
# Usage: just deploy-nginx (uploads script + config, then runs this)
|
||||
# or: sudo bash /tmp/deploy-server.sh
|
||||
@@ -27,8 +27,8 @@ printf "==================================\n\n"
|
||||
printf "📋 Step 1: Fixing file permissions...\n"
|
||||
echo "--------------------------------------"
|
||||
|
||||
chown -R www-data:posterg /var/www/xamxam/
|
||||
ok "Ownership: www-data:posterg"
|
||||
chown -R www-data:xamxam /var/www/xamxam/
|
||||
ok "Ownership: www-data:xamxam"
|
||||
|
||||
find /var/www/xamxam -type d -exec chmod 2775 {} \;
|
||||
ok "Directories: 2775 (setgid)"
|
||||
@@ -44,30 +44,30 @@ fi
|
||||
|
||||
# Ensure writable cache subdirectories exist for php-fpm (www-data)
|
||||
mkdir -p /var/www/xamxam/storage/cache/rate_limit
|
||||
chown -R www-data:posterg /var/www/xamxam/storage/cache
|
||||
chown -R www-data:xamxam /var/www/xamxam/storage/cache
|
||||
chmod -R 2775 /var/www/xamxam/storage/cache
|
||||
ok "Cache dirs: created and owned by www-data:posterg"
|
||||
ok "Cache dirs: created and owned by www-data:xamxam"
|
||||
|
||||
# ── Step 2: Nginx config ──────────────────────────────────────────────────────
|
||||
printf "\n📋 Step 2: Deploying nginx configuration...\n"
|
||||
echo "--------------------------------------------"
|
||||
|
||||
if [ ! -f "/tmp/posterg.conf" ]; then
|
||||
err "/tmp/posterg.conf not found — run: just deploy-nginx"
|
||||
if [ ! -f "/tmp/xamxam.conf" ]; then
|
||||
err "/tmp/xamxam.conf not found — run: just deploy-nginx"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f "/etc/nginx/sites-available/posterg" ]; then
|
||||
cp /etc/nginx/sites-available/posterg \
|
||||
"/etc/nginx/sites-available/posterg.backup.$(date +%Y%m%d_%H%M%S)"
|
||||
if [ -f "/etc/nginx/sites-available/xamxam" ]; then
|
||||
cp /etc/nginx/sites-available/xamxam \
|
||||
"/etc/nginx/sites-available/xamxam.backup.$(date +%Y%m%d_%H%M%S)"
|
||||
ok "Backed up existing config"
|
||||
fi
|
||||
|
||||
cp /tmp/posterg.conf /etc/nginx/sites-available/posterg
|
||||
cp /tmp/xamxam.conf /etc/nginx/sites-available/xamxam
|
||||
ok "Installed new nginx config"
|
||||
|
||||
if [ ! -L "/etc/nginx/sites-enabled/posterg" ]; then
|
||||
ln -s /etc/nginx/sites-available/posterg /etc/nginx/sites-enabled/posterg
|
||||
if [ ! -L "/etc/nginx/sites-enabled/xamxam" ]; then
|
||||
ln -s /etc/nginx/sites-available/xamxam /etc/nginx/sites-enabled/xamxam
|
||||
ok "Created sites-enabled symlink"
|
||||
fi
|
||||
|
||||
@@ -79,8 +79,8 @@ if nginx -t 2>&1; then
|
||||
ok "Nginx configuration is valid"
|
||||
else
|
||||
err "Nginx configuration has errors — restoring backup"
|
||||
latest=$(ls -t /etc/nginx/sites-available/posterg.backup.* 2>/dev/null | head -1)
|
||||
[ -n "$latest" ] && cp "$latest" /etc/nginx/sites-available/posterg
|
||||
latest=$(ls -t /etc/nginx/sites-available/xamxam.backup.* 2>/dev/null | head -1)
|
||||
[ -n "$latest" ] && cp "$latest" /etc/nginx/sites-available/xamxam
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -99,6 +99,6 @@ ok "Nginx config installed"
|
||||
ok "Configuration validated"
|
||||
ok "Nginx reloaded"
|
||||
printf "\nVerify:\n"
|
||||
printf " https://posterg.erg.be/\n"
|
||||
printf " https://posterg.erg.be/admin/\n"
|
||||
printf " https://posterg.erg.be/storage/posterg.db (should 403/404)\n"
|
||||
printf " https://xamxam.erg.be/\n"
|
||||
printf " https://xamxam.erg.be/admin/\n"
|
||||
printf " https://xamxam.erg.be/storage/xamxam.db (should 403/404)\n"
|
||||
|
||||
Reference in New Issue
Block a user