4NK_node/proxy/nginx.conf
Debian 3488b497de release: 1.1.2 (latest)
- HSTS activé sur Nginx
- Scripts de déploiement initial (avec/sans certificats)
- Docs installation/configuration enrichies (webroot, renouvellement, déploiement)
2025-08-27 23:38:14 +00:00

118 lines
3.4 KiB
Nginx Configuration File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

server {
listen 80;
server_name dev4.4nkweb.com;
# ACME HTTP-01 challenge (Lets Encrypt)
location ^~ /.well-known/acme-challenge/ {
alias /var/www/certbot/.well-known/acme-challenge/;
default_type text/plain;
try_files $uri =404;
}
# Redirection par défaut vers HTTPS
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl http2;
server_name _;
ssl_certificate /etc/nginx/certs/server.crt;
ssl_certificate_key /etc/nginx/certs/server.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
# Sécurité de base
add_header X-Frame-Options SAMEORIGIN always;
add_header X-Content-Type-Options nosniff always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# CSP minimale (adapter selon besoins)
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self' ws: wss: http: https:; img-src 'self' data:;" always;
# Résolveur DNS Docker pour les upstreams dynamiques
resolver 127.0.0.11 ipv6=off valid=10s;
# ihm_client statique servi directement
root /usr/share/nginx/html;
index index.html;
# Types MIME (WASM/ESM)
include /etc/nginx/mime.types;
types {
application/javascript mjs;
application/wasm wasm;
}
location / {
try_files $uri $uri/ /index.html;
}
# API http sdk_relay
location /api/ {
proxy_pass http://sdk_relay_1:8091/;
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;
}
# sdk_storage HTTP (tide 8081)
location /storage/ {
proxy_pass http://sdk_storage:8081/;
proxy_http_version 1.1;
proxy_set_header Host sdk_storage;
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_read_timeout 60s;
proxy_send_timeout 60s;
}
# WebSocket sdk_relay
location /ws/ {
proxy_pass http://sdk_relay_1:8090;
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-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400;
proxy_send_timeout 86400;
}
# WebSocket sdk_signer (port 9090)
location /signer/ws/ {
set $signer_upstream sdk_signer:9090;
proxy_pass http://$signer_upstream;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host sdk_signer;
proxy_set_header Origin "http://sdk_signer:9090";
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_buffering off;
proxy_read_timeout 86400;
proxy_send_timeout 86400;
}
# Healthcheck sdk_signer HTTP
location /signer/health {
proxy_pass http://sdk_signer:9092/health;
proxy_set_header Host sdk_signer;
}
# Healthcheck simple
location = /health {
return 200;
}
}