mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-09-25 18:03:05 +02:00
- nginx/docs/PRODUCTION_DEPLOYMENT.md: drop stale htpasswd/Basic-auth model, manual server-side deploy step, /var/www/posterg paths and hardcoded IP; describe the PHP-layer AdminAuth, automated 📋 Deploying nginx configuration… xamxam.conf sent 145 bytes received 125 bytes 540.00 bytes/sec total size is 10,012 speedup is 37.08 deploy-server.sh sent 143 bytes received 113 bytes 512.00 bytes/sec total size is 8,519 speedup is 33.28, and what deploy-server.sh actually does. - nginx/docs/QUICK_REFERENCE.md: replace htpasswd user management with AdminAuth guidance; fix php8.2->php8.4, log paths, admin rate limit (300r/m), socket path. - nginx/README.md, nginx/SETUP.md: note 📋 Deploying nginx configuration… xamxam.conf sent 145 bytes received 125 bytes 540.00 bytes/sec total size is 10,012 speedup is 37.08 deploy-server.sh sent 143 bytes received 113 bytes 170.67 bytes/sec total size is 8,519 speedup is 33.28 automates deploy-server.sh (no manual ssh/sudo step). - docs/deployment.md: correct deploy-code scope (code-only, no --chown), fix the /var/log/xamxam provisioning step (deploy-server.sh via deploy-nginx, not deploy-code), document the setup-server.sh prerequisite and fresh-box caveat. - README.md: replace the incomplete manual first-time setup snippet with the real setup-server.sh + provision-server flow and a fresh-box caveat.
117 lines
2.5 KiB
Markdown
117 lines
2.5 KiB
Markdown
# Nginx Setup — XAMXAM
|
|
|
|
Complete setup guide for nginx with security features and password protection.
|
|
|
|
## Prerequisites
|
|
|
|
- Ubuntu/Debian server with root access
|
|
- Nginx installed
|
|
- PHP-FPM installed (PHP 8.4)
|
|
- Domain name pointed to your server
|
|
|
|
## Quick Setup (Recommended)
|
|
|
|
### 1. Deploy from your local machine
|
|
|
|
`just deploy-nginx` uploads `nginx/xamxam.conf` and `scripts/deploy-server.sh`, runs the
|
|
script as root on the server (installing the config, fixing permissions, and reloading
|
|
nginx + php-fpm), then cleans up. No manual server-side step is required:
|
|
|
|
```bash
|
|
just deploy-nginx
|
|
```
|
|
|
|
### 2. Set admin password (first time only)
|
|
|
|
Visit `/admin/parametres` → Account tab and set the admin password there.
|
|
|
|
## Manual Setup Steps
|
|
|
|
### 1. Install Required Packages
|
|
|
|
```bash
|
|
sudo apt update
|
|
sudo apt install nginx php8.4-fpm php8.4-curl php8.4-sqlite3
|
|
```
|
|
|
|
### 2. Set admin password
|
|
|
|
Visit `/admin/parametres` → Account tab in the admin panel to set the password.
|
|
|
|
Or generate a hash and insert it directly:
|
|
```bash
|
|
php -r "echo password_hash('your-secret-password', PASSWORD_BCRYPT);"
|
|
```
|
|
|
|
### 3. Copy Nginx Configuration
|
|
|
|
```bash
|
|
sudo cp nginx/xamxam.conf /etc/nginx/sites-available/xamxam
|
|
sudo ln -s /etc/nginx/sites-available/xamxam /etc/nginx/sites-enabled/
|
|
sudo rm -f /etc/nginx/sites-enabled/default
|
|
```
|
|
|
|
### 4. Test and Reload
|
|
|
|
```bash
|
|
sudo nginx -t
|
|
sudo systemctl reload nginx
|
|
sudo systemctl status nginx
|
|
```
|
|
|
|
## Testing
|
|
|
|
### Test Admin Authentication
|
|
|
|
```bash
|
|
# Should redirect to login page (302)
|
|
curl -I https://xamxam.erg.be/admin/
|
|
```
|
|
|
|
### Test File Protection
|
|
|
|
```bash
|
|
# Should return 403
|
|
curl -I https://xamxam.erg.be/storage/test.db
|
|
curl -I https://xamxam.erg.be/src/Database.php
|
|
```
|
|
|
|
### Test Security Headers
|
|
|
|
```bash
|
|
curl -I https://xamxam.erg.be/ | grep -E "X-|Strict-Transport"
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### 502 Bad Gateway
|
|
```bash
|
|
sudo systemctl status php8.4-fpm
|
|
sudo systemctl restart php8.4-fpm
|
|
```
|
|
|
|
### Configuration errors
|
|
```bash
|
|
sudo nginx -t
|
|
```
|
|
|
|
## Maintenance
|
|
|
|
### Change Admin Password
|
|
|
|
Visit `/admin/parametres` → Account tab or generate a new hash:
|
|
```bash
|
|
php -r "echo password_hash('new-password', PASSWORD_BCRYPT);"
|
|
```
|
|
|
|
### Reload Configuration
|
|
```bash
|
|
sudo nginx -t && sudo systemctl reload nginx
|
|
```
|
|
|
|
## See Also
|
|
|
|
- **[docs/PRODUCTION_DEPLOYMENT.md](docs/PRODUCTION_DEPLOYMENT.md)** - Detailed deployment
|
|
- **[docs/QUICK_REFERENCE.md](docs/QUICK_REFERENCE.md)** - Command reference
|
|
- **[docs/PHP_AUTH_LAYER.md](docs/PHP_AUTH_LAYER.md)** - Auth layer documentation
|