Files
xamxam/docs/SERVER_SETUP.md
Théophile Gervreau-Mercier 4bbbc58e24 Fix admin CSS not loading and quirks mode issues
Fixed multiple issues in admin panel:

1. CSS path: modern-normalize.css → modern-normalize.min.css
   (File is actually named .min.css)

2. Icon path: assets/icon.svg → /assets/admin_favicon.svg
   (Was relative, now absolute; correct filename)

3. Navigation: /admin/list.php → /admin/
   (list.php was renamed to index.php)

4. Short PHP tags: <? → <?php
   (Better compatibility, some servers don't enable short_open_tag)

5. Quirks mode warning was due to CSS not loading, not DOCTYPE
   (DOCTYPE was already present)

Files modified:
- public/admin/inc/head.php (main fixes)
- public/admin/index.php (short tags)
- public/admin/add.php (short tags)
- public/admin/import.php (short tags)

Need to redeploy for production: just deploy
2026-02-06 13:26:24 +01:00

2.6 KiB

Server Setup (Manual)

Since sudo prompts don't work over SSH in justfile, do the initial setup manually.

One-Time Setup on Server

# 1. SSH to server
ssh posterg

# 2. Backup current site (recommended)
sudo cp -r /var/www/html /var/www/html.backup

# 3. Create new directory structure
sudo mkdir -p /var/www/posterg

# 4. Set ownership (www-data is the web server user)
sudo chown www-data:posterg /var/www/posterg

# 5. Set permissions (775 = rwxrwxr-x)
sudo chmod 775 /var/www/posterg

# 6. Verify
ls -ld /var/www/posterg
# Should show: drwxrwxr-x 2 www-data posterg 4096 ... /var/www/posterg

# 7. Exit server
exit

Deploy from Local Machine

just deploy

Complete Deployment Process

# On server (one time)
ssh posterg
sudo mkdir -p /var/www/posterg
sudo chown www-data:posterg /var/www/posterg
sudo chmod 775 /var/www/posterg
exit

# From local machine
just deploy           # Deploy files
just deploy-nginx     # Update nginx config

# On server - apply nginx config
ssh posterg
sudo bash /tmp/deploy-production.sh
sudo systemctl reload nginx
exit

# Verify from local
just server-status

Important Notes

  • Don't delete /var/www/html/ yet! Keep it as backup until you confirm the new structure works
  • The new structure uses /var/www/posterg/public/ as DocumentRoot
  • Nginx must be updated to point to the new location

After Confirming Everything Works

Once you've verified the new deployment works:

ssh posterg
sudo rm -rf /var/www/html.backup  # Remove backup if no longer needed
sudo rm -rf /var/www/html          # Remove old directory

Directory Structure on Server

/var/www/
├── html/              ← OLD (keep as backup for now)
├── html.backup/       ← BACKUP (can delete later)
└── posterg/           ← NEW
    ├── public/        ← DocumentRoot (nginx serves from here)
    ├── includes/
    ├── config/
    ├── database/
    ├── lib/
    └── vendor/

Troubleshooting

Permission denied during deploy

Cause: Directory doesn't exist or has wrong ownership
Fix: Run the setup commands above

Nginx 403 Forbidden

Cause: Wrong permissions on files
Fix:

ssh posterg
cd /var/www/posterg
sudo chown -R www-data:posterg .
sudo find . -type d -exec chmod 755 {} \;
sudo find . -type f -exec chmod 644 {} \;
sudo chmod 775 database/
sudo chmod 660 database/*.db

Database connection errors

Cause: Database file permissions
Fix:

ssh posterg
sudo chown www-data:posterg /var/www/posterg/database/test.db
sudo chmod 660 /var/www/posterg/database/test.db