163 lines
5.3 KiB
Plaintext
163 lines
5.3 KiB
Plaintext
server {
|
|
listen 80;
|
|
server_name dev4.4nkweb.com;
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
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;
|
|
|
|
# Security headers (basic hardening)
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "no-referrer" always;
|
|
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
|
|
# Minimal CSP allowing Next.js static and same-origin; adjust later if needed
|
|
add_header Content-Security-Policy "default-src 'self'; img-src 'self' data: blob:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; connect-src 'self' https: wss:; font-src 'self' data:" always;
|
|
|
|
# ihm_client (root)
|
|
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;
|
|
}
|
|
|
|
# Favicon (global)
|
|
location = /favicon.ico {
|
|
root /home/debian/lecoffre_node/conf/nginx/assets;
|
|
try_files /favicon.ico =404;
|
|
access_log off;
|
|
expires 30d;
|
|
}
|
|
|
|
# Static assets long cache (root and /lecoffre)
|
|
location ~* ^(/_next/static/|/lecoffre/_next/static/|/.+\.(?:css|js|png|jpg|jpeg|gif|svg|ico|webp|woff2?))$ {
|
|
expires 30d;
|
|
add_header Cache-Control "public, max-age=2592000, immutable" always;
|
|
proxy_pass http://127.0.0.1:3000$request_uri;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_read_timeout 300;
|
|
}
|
|
|
|
# lecoffre-front
|
|
location /lecoffre/ {
|
|
proxy_pass http://127.0.0.1:3000/;
|
|
include /etc/nginx/proxy_params;
|
|
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;
|
|
proxy_read_timeout 300;
|
|
}
|
|
|
|
# Next.js assets and HMR under basePath
|
|
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 https;
|
|
proxy_buffering off;
|
|
proxy_pass http://127.0.0.1:3000/_next/webpack-hmr;
|
|
proxy_read_timeout 600s;
|
|
}
|
|
|
|
location /lecoffre/_next/ {
|
|
proxy_pass http://127.0.0.1:3000/_next/;
|
|
include /etc/nginx/proxy_params;
|
|
proxy_read_timeout 300;
|
|
}
|
|
|
|
# Favicon sous /lecoffre
|
|
location = /lecoffre/favicon.ico {
|
|
root /home/debian/lecoffre_node/conf/nginx/assets;
|
|
try_files /favicon.ico =404;
|
|
access_log off;
|
|
expires 30d;
|
|
}
|
|
|
|
# Next.js assets (served at root by the app)
|
|
location /_next/ {
|
|
proxy_pass http://127.0.0.1:3000/_next/;
|
|
include /etc/nginx/proxy_params;
|
|
proxy_read_timeout 300;
|
|
}
|
|
|
|
# lecoffre-back
|
|
location /back/ {
|
|
proxy_pass http://127.0.0.1:8080/;
|
|
include /etc/nginx/proxy_params;
|
|
proxy_read_timeout 300;
|
|
}
|
|
|
|
# blindbit
|
|
location /blindbit/ {
|
|
proxy_pass http://127.0.0.1:8000/;
|
|
include /etc/nginx/proxy_params;
|
|
proxy_read_timeout 300;
|
|
}
|
|
|
|
# signer (sdk_signer)
|
|
location /signer/ {
|
|
proxy_pass http://127.0.0.1:3001/;
|
|
include /etc/nginx/proxy_params;
|
|
proxy_read_timeout 300;
|
|
}
|
|
|
|
# storage (sdk_storage)
|
|
location /storage/ {
|
|
proxy_pass http://127.0.0.1:8081/;
|
|
include /etc/nginx/proxy_params;
|
|
proxy_read_timeout 300;
|
|
}
|
|
|
|
# WebSocket relay on /ws → 8090
|
|
location = /ws {
|
|
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 https;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_buffering off;
|
|
proxy_pass http://127.0.0.1:8090/;
|
|
proxy_read_timeout 600s;
|
|
}
|
|
|
|
location /ws/ {
|
|
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 https;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_buffering off;
|
|
# Strip /ws prefix when proxying to backend root
|
|
proxy_pass http://127.0.0.1:8090/;
|
|
proxy_read_timeout 600s;
|
|
}
|
|
|
|
# Next.js HMR websocket for lecoffre-front
|
|
location /_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 https;
|
|
proxy_buffering off;
|
|
proxy_pass http://127.0.0.1:3000/_next/webpack-hmr;
|
|
proxy_read_timeout 300;
|
|
}
|
|
}
|