2.6 KiB
2.6 KiB
Vhost local HTTP pour local.lecoffreio.4nkweb
Objectif: servir l’IHM en HTTP pur (sans HTTPS ni HSTS) pour le domaine local local.lecoffreio.4nkweb
sur le port 3000.
Configuration Nginx
Fichier: conf/nginx/local.lecoffreio.4nkweb-3000.conf
server {
listen 127.0.0.1:3000;
server_name local.lecoffreio.4nkweb;
# Pas de redirection HTTPS ni HSTS
location = /favicon.ico {
root /home/debian/lecoffre_node/conf/nginx/assets;
}
location = /lecoffre {
proxy_pass http://127.0.0.2:3004;
include /etc/nginx/proxy_params;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto http;
proxy_set_header X-Forwarded-Prefix /lecoffre;
proxy_read_timeout 300;
}
location /lecoffre/ {
proxy_pass http://127.0.0.2:3004;
include /etc/nginx/proxy_params;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto http;
proxy_set_header X-Forwarded-Prefix /lecoffre;
proxy_read_timeout 300;
}
location /lecoffre/_next/webpack-hmr {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto http;
proxy_buffering off;
proxy_pass http://127.0.0.2:3004/lecoffre/_next/webpack-hmr;
proxy_read_timeout 600s;
}
location ~* ^(/_next/static/|/lecoffre/_next/static/|/.+\.(?:css|js|png|jpg|jpeg|gif|svg|ico|webp|woff2?))$ {
expires 7d;
add_header Cache-Control "public, max-age=604800, immutable" always;
proxy_pass http://127.0.0.2:3004$request_uri;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto http;
proxy_read_timeout 300;
}
}
Activation: lien symbolique vers /etc/nginx/sites-enabled/local.lecoffreio.4nkweb-3000.conf
puis sudo nginx -t && sudo systemctl reload nginx
.
DNS local
Ajouter dans /etc/hosts
:
127.0.0.1 local.lecoffreio.4nkweb
Variables d’environnement recommandées (local HTTP)
NEXT_PUBLIC_4NK_URL=http://local.lecoffreio.4nkweb:3000
NEXT_PUBLIC_FRONT_APP_HOST=local.lecoffreio.4nkweb
NEXT_PUBLIC_FRONT_APP_PORT=3000
NEXT_PUBLIC_FRONT_APP_ROOT_URL=/lecoffre
NEXT_PUBLIC_ANK_BASE_REDIRECT_URI=http://local.lecoffreio.4nkweb:3000/authorized-client
NEXT_PUBLIC_4NK_IFRAME_URL=http://local.lecoffreio.4nkweb:3000/lecoffre
Note cookies: en HTTP, les cookies marqués Secure
ne sont pas envoyés. Adapter la config backend en conséquence pour ce domaine local.