chore(nginx,docs): piloter Nginx via conf/nginx/* (symlinks conf.d), désactivation doublon, MAJ doc déploiement et procédure rebuild front avec .env.production
This commit is contained in:
parent
3114d99fec
commit
58f745d885
@ -0,0 +1,31 @@
|
|||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
server_name dev4.4nkweb.com;
|
||||||
|
ssl_certificate /etc/letsencrypt/live/dev4.4nkweb.com/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/dev4.4nkweb.com/privkey.pem;
|
||||||
|
include /etc/nginx/proxy_params;
|
||||||
|
location /lecoffre/ {
|
||||||
|
proxy_pass http://127.0.0.2:3004/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Forwarded-Proto https;
|
||||||
|
proxy_set_header X-Forwarded-Host $host;
|
||||||
|
proxy_set_header X-Forwarded-Prefix /lecoffre;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://127.0.0.1:3003;
|
||||||
|
include /etc/nginx/proxy_params;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_read_timeout 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /lecoffre/_next/ {
|
||||||
|
proxy_read_timeout 300;
|
||||||
|
}
|
||||||
|
location /_next/ {
|
||||||
|
proxy_pass http://127.0.0.2:3004/_next/;
|
||||||
|
proxy_read_timeout 300;
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
server {
|
server {
|
||||||
listen 127.0.0.1:3000;
|
listen 0.0.0.0:3000;
|
||||||
server_name local.4nkweb.com;
|
server_name local.4nkweb.com;
|
||||||
|
|
||||||
|
# Redirection vers HTTPS avec le chemin /lecoffre
|
||||||
return 301 https://dev4.4nkweb.com/lecoffre$request_uri;
|
return 301 https://dev4.4nkweb.com/lecoffre$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,3 +86,37 @@ sudo dscacheutil -flushcache
|
|||||||
```
|
```
|
||||||
|
|
||||||
Après ces modifications, `http://local.4nkweb.com:3000/authorized-client?code=...` devrait rediriger correctement vers `https://dev4.4nkweb.com/lecoffre/authorized-client?code=...`.
|
Après ces modifications, `http://local.4nkweb.com:3000/authorized-client?code=...` devrait rediriger correctement vers `https://dev4.4nkweb.com/lecoffre/authorized-client?code=...`.
|
||||||
|
|
||||||
|
## Pilotage Nginx depuis le dépôt
|
||||||
|
|
||||||
|
- Conf actives sur le système pointent vers les fichiers du dépôt:
|
||||||
|
- `/etc/nginx/conf.d/ssl-dev4.4nkweb.com.conf` → lien vers `conf/nginx/dev4.4nkweb.com-https.conf`
|
||||||
|
- `/etc/nginx/conf.d/local.4nkweb.com-3000.conf` → lien vers `conf/nginx/local.4nkweb.com-3000.conf`
|
||||||
|
- Doublon supprimé: `/etc/nginx/sites-enabled/dev4.4nkweb.com.conf`.
|
||||||
|
- Vérification et rechargement:
|
||||||
|
- `sudo nginx -t`
|
||||||
|
- `sudo nginx -s reload`
|
||||||
|
|
||||||
|
## Variables .env critiques pour le front Next.js
|
||||||
|
|
||||||
|
Ces variables doivent être sans quotes et sans espaces autour de `=` et alignées sur le sous-chemin `/lecoffre`:
|
||||||
|
|
||||||
|
- `NEXT_PUBLIC_ANK_BASE_REDIRECT_URI=https://dev4.4nkweb.com/lecoffre/authorized-client`
|
||||||
|
- `NEXT_PUBLIC_TARGET_ORIGIN=https://dev4.4nkweb.com/lecoffre`
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
- Les variables `NEXT_PUBLIC_*` sont prises en compte au build; un rebuild est nécessaire après modification.
|
||||||
|
|
||||||
|
## Rebuild de lecoffre-front avec le .env courant
|
||||||
|
|
||||||
|
Étapes:
|
||||||
|
1. Vérifier que le conteneur contient le code:
|
||||||
|
- `sudo docker exec -i lecoffre-front sh -lc "test -f package.json && echo ok || echo ko"`
|
||||||
|
2. Lancer le build (mémoire augmentée):
|
||||||
|
- `sudo docker exec -i lecoffre-front sh -lc "export NODE_OPTIONS=--max-old-space-size=2048; npm run build"`
|
||||||
|
3. Redémarrer le service:
|
||||||
|
- `sudo docker compose -f docker-compose.yml restart lecoffre-front`
|
||||||
|
4. Tester:
|
||||||
|
- `curl -si https://dev4.4nkweb.com/lecoffre/`
|
||||||
|
|
||||||
|
Incident connu: 500 SSR « Invalid targetOrigin » résolu en corrigeant `NEXT_PUBLIC_TARGET_ORIGIN` puis rebuild.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user