Configuration Nginx - Backup avant recréation VM
Date : 04-01-2026
Raison : VM 107 ne démarre plus, recréation avec Debian 12 cloud
1. Infos VM
| Propriété |
Valeur |
| VMID |
107 |
| IP |
192.168.1.104 |
| IP publique |
82.65.119.221 |
| Hostname |
nginx |
| User SSH |
gouroubleu |
2. DNS o2switch
| Propriété |
Valeur |
| Provider |
o2switch |
| cPanel URL |
https://yellow.o2switch.net:2083 |
| Username |
deas8499 |
| API Token |
3HW5KTGKHFAL889K9M2K9XJ4MU3D5SWV |
| Domaine |
nowhere84.com |
| Wildcard |
*.33800.nowhere84.com → 82.65.119.221 |
API o2switch
# Lister DNS
curl -H "Authorization: cpanel deas8499:3HW5KTGKHFAL889K9M2K9XJ4MU3D5SWV" \
"https://yellow.o2switch.net:2083/execute/ZoneEdit/fetch_zone_records?domain=nowhere84.com"
# Ajouter enregistrement
curl -H "Authorization: cpanel deas8499:3HW5KTGKHFAL889K9M2K9XJ4MU3D5SWV" \
"https://yellow.o2switch.net:2083/execute/ZoneEdit/add_zone_record?domain=nowhere84.com&name=*.33800&type=A&address=82.65.119.221&ttl=3600"
3. SSL Wildcard (Let's Encrypt)
| Fichier |
Chemin |
| Certificat |
/etc/letsencrypt/live/33800.nowhere84.com/fullchain.pem |
| Clé privée |
/etc/letsencrypt/live/33800.nowhere84.com/privkey.pem |
Renouvellement : certbot renew
4. Sites à configurer (reverse proxy)
PROD (vers prod-portainer 192.168.1.12)
| Domaine |
Backend |
| hellocar-api-prod.33800.nowhere84.com |
192.168.1.12:4510 |
| hellocar-public-prod.33800.nowhere84.com |
192.168.1.12:4501 |
| hellocar-admin-prod.33800.nowhere84.com |
192.168.1.12:4500 |
| supabase-studio-prod.33800.nowhere84.com |
192.168.1.12:8201 |
| supabase-api-prod.33800.nowhere84.com |
192.168.1.12:8200 |
| notif-logger.33800.nowhere84.com |
192.168.1.12:5300 |
| ntfy.33800.nowhere84.com |
192.168.1.12:8080 |
| grafana.33800.nowhere84.com |
192.168.1.12:3000 |
| downloads.33800.nowhere84.com |
/mnt/stock_36to/data/33800-stack/downloads/ (statique) |
| dashboard.33800.nowhere84.com |
/mnt/stock_36to/data/33800-stack/monitoring/dashboard.html (statique) |
DEV (vers dev-portainer 192.168.1.51)
| Domaine |
Backend |
| needfinder-api-dev.33800.nowhere84.com |
192.168.1.51:5200 |
| supabase-studio-dev.33800.nowhere84.com |
192.168.1.51:8101 |
| supabase-api-dev.33800.nowhere84.com |
192.168.1.51:8100 |
Auto-expose vscode (ports dynamiques)
| Pattern |
Backend |
| XXXX-dev.33800.nowhere84.com |
192.168.1.154:XXXX |
5. Template config Nginx
server {
listen 80;
server_name DOMAIN;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name DOMAIN;
ssl_certificate /etc/letsencrypt/live/33800.nowhere84.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/33800.nowhere84.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
location / {
proxy_pass http://BACKEND;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
6. Post-installation
apt install nginx certbot python3-certbot-nginx nfs-common qemu-guest-agent
- Monter NFS :
192.168.1.10:/stock_36to/data /mnt/stock_36to nfs defaults,_netdev 0 0
- Installer certificat wildcard (ou copier depuis backup)
- Générer configs avec
/mnt/stock_36to/data/33800-stack/scripts/nginx/generate.sh
- Symlink vers sites-enabled
nginx -t && systemctl reload nginx
7. Correction script generate.sh
Le script pointe vers 192.168.1.11 pour PROD, à changer vers 192.168.1.12 :
DOCKER_HOST_PROD="192.168.1.12" # prod-portainer
DOCKER_HOST_DEV="192.168.1.51" # dev-portainer