- Changed ownership of all files to scheianu:scheianu - Set directories to 755 permissions (rwxr-xr-x) - Set files to 644 permissions (rw-r--r--) - Made shell scripts executable (755) - Allows development without requiring sudo for file modifications - Improves development workflow and security
2.4 KiB
2.4 KiB
Quick Start: Nginx Setup for DigiServer v2
Pre-requisites
- SSL certificates in
./data/nginx-ssl/cert.pemand./data/nginx-ssl/key.pem - Docker and Docker Compose installed
- Port 80 and 443 available
Quick Setup (3 steps)
1. Generate Self-Signed Certificates
./generate_nginx_certs.sh localhost 365
2. Update Nginx Configuration
- Edit
nginx.confto set your domain:server_name localhost; # Change to your domain
3. Start Docker Compose
docker-compose up -d
Verification
Check if Nginx is running
docker ps | grep nginx
Test HTTP → HTTPS redirect
curl -L http://localhost
Test HTTPS (with self-signed cert)
curl -k https://localhost
View logs
docker logs digiserver-nginx
docker exec digiserver-nginx tail -f /var/log/nginx/access.log
Using Production Certificates
Option A: Let's Encrypt (Free)
- Install certbot:
apt-get install certbot - Generate cert:
certbot certonly --standalone -d your-domain.com - Copy cert:
cp /etc/letsencrypt/live/your-domain.com/fullchain.pem ./data/nginx-ssl/cert.pem - Copy key:
cp /etc/letsencrypt/live/your-domain.com/privkey.pem ./data/nginx-ssl/key.pem - Fix permissions:
sudo chown 101:101 ./data/nginx-ssl/* - Reload:
docker exec digiserver-nginx nginx -s reload
Option B: Commercial Certificate
- Place your certificate files in
./data/nginx-ssl/cert.pemand./data/nginx-ssl/key.pem - Fix permissions:
sudo chown 101:101 ./data/nginx-ssl/* - Reload:
docker exec digiserver-nginx nginx -s reload
Troubleshooting
| Issue | Solution |
|---|---|
| Port 80/443 in use | sudo netstat -tlnp | grep :80 or :443 |
| Certificate permission denied | sudo chown 101:101 ./data/nginx-ssl/* |
| Nginx won't start | docker logs digiserver-nginx |
| Connection refused | Check firewall: sudo ufw allow 80/tcp && sudo ufw allow 443/tcp |
File Locations
- Main config:
./nginx.conf - SSL certs:
./data/nginx-ssl/ - Logs:
./data/nginx-logs/ - Custom domains:
./nginx-custom-domains.conf(auto-generated)
Next: Production Setup
- Update
.envwith your DOMAIN and EMAIL - Configure HTTPS settings in admin panel
- Run:
python nginx_manager.py generate - Test:
docker exec digiserver-nginx nginx -t - Reload:
docker exec digiserver-nginx nginx -s reload