mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
65 lines
1.5 KiB
Markdown
65 lines
1.5 KiB
Markdown
# Server Setup
|
|
|
|
## One-time setup on server
|
|
|
|
```bash
|
|
ssh posterg
|
|
sudo mkdir -p /var/www/posterg
|
|
sudo chown www-data:posterg /var/www/posterg
|
|
sudo chmod 775 /var/www/posterg
|
|
exit
|
|
```
|
|
|
|
## Deploying the application
|
|
|
|
Files are pushed via rsync — there is no repo on the server.
|
|
|
|
```bash
|
|
# Push all app files
|
|
just deploy
|
|
|
|
# Push initial database (aborts if remote DB already exists)
|
|
just deploy-db
|
|
```
|
|
|
|
## Applying the nginx config
|
|
|
|
The config is in `nginx/posterg.conf`. Upload it and run the deploy script on the server:
|
|
|
|
```bash
|
|
rsync -v nginx/posterg.conf posterg:/tmp/posterg.conf
|
|
ssh posterg "sudo bash /var/www/posterg/scripts/deploy-server.sh"
|
|
ssh posterg "sudo systemctl reload nginx"
|
|
```
|
|
|
|
`scripts/deploy-server.sh` fixes ownership/permissions and installs the nginx config
|
|
from `/tmp/posterg.conf`. It must be run as root.
|
|
|
|
## Managing admin users
|
|
|
|
```bash
|
|
ssh posterg "sudo bash /var/www/posterg/scripts/manage-admin-users.sh"
|
|
```
|
|
|
|
This is an interactive menu for adding, changing, and deleting htpasswd entries
|
|
at `/etc/nginx/.htpasswd-posterg`.
|
|
|
|
## Troubleshooting
|
|
|
|
### Nginx 403 Forbidden
|
|
```bash
|
|
ssh posterg
|
|
sudo chown -R www-data:posterg /var/www/posterg
|
|
sudo find /var/www/posterg -type d -exec chmod 755 {} \;
|
|
sudo find /var/www/posterg -type f -exec chmod 644 {} \;
|
|
sudo chmod 775 /var/www/posterg/storage
|
|
sudo chmod 660 /var/www/posterg/storage/*.db
|
|
```
|
|
|
|
### Database permission error
|
|
```bash
|
|
ssh posterg
|
|
sudo chown www-data:posterg /var/www/posterg/storage/test.db
|
|
sudo chmod 660 /var/www/posterg/storage/test.db
|
|
```
|