96 lines
3.8 KiB
Plaintext
96 lines
3.8 KiB
Plaintext
# /etc/nginx/sites-available/bistrousky
|
|
# Generováno install.sh — pro produkci uprav DOMAIN a aktivuj SSL blok
|
|
|
|
upstream bistrousky_app {
|
|
server 127.0.0.1:3000;
|
|
keepalive 64;
|
|
}
|
|
|
|
# ── HTTP → HTTPS přesměrování ─────────────────────────────────────────────
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name shop.bistrousky.cz; # ← uprav na svou doménu
|
|
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/certbot;
|
|
}
|
|
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
}
|
|
|
|
# ── HTTPS (aktivuj po certbot) ────────────────────────────────────────────
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
server_name shop.bistrousky.cz; # ← uprav na svou doménu
|
|
|
|
# SSL certifikáty (generuje certbot)
|
|
ssl_certificate /etc/letsencrypt/live/shop.bistrousky.cz/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/shop.bistrousky.cz/privkey.pem;
|
|
ssl_trusted_certificate /etc/letsencrypt/live/shop.bistrousky.cz/chain.pem;
|
|
|
|
# Moderní SSL nastavení
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
|
|
ssl_prefer_server_ciphers off;
|
|
ssl_session_timeout 1d;
|
|
ssl_session_cache shared:SSL:10m;
|
|
ssl_stapling on;
|
|
ssl_stapling_verify on;
|
|
|
|
# Security headers
|
|
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
|
|
add_header X-Frame-Options SAMEORIGIN always;
|
|
add_header X-Content-Type-Options nosniff always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
|
|
# Limity
|
|
client_max_body_size 10M;
|
|
|
|
# Logy
|
|
access_log /var/log/nginx/bistrousky.access.log;
|
|
error_log /var/log/nginx/bistrousky.error.log;
|
|
|
|
# ── Statické soubory Next.js (cache navždy — hash v názvu) ────────────
|
|
location /_next/static/ {
|
|
proxy_pass http://bistrousky_app;
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
access_log off;
|
|
}
|
|
|
|
# ── Veřejné soubory ───────────────────────────────────────────────────
|
|
location /favicon.ico {
|
|
proxy_pass http://bistrousky_app;
|
|
add_header Cache-Control "public, max-age=86400";
|
|
access_log off;
|
|
}
|
|
|
|
# ── Stripe webhook — zvýšený timeout ─────────────────────────────────
|
|
location /api/webhooks/ {
|
|
proxy_pass http://bistrousky_app;
|
|
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_read_timeout 30s;
|
|
}
|
|
|
|
# ── Aplikace ─────────────────────────────────────────────────────────
|
|
location / {
|
|
proxy_pass http://bistrousky_app;
|
|
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_cache_bypass $http_upgrade;
|
|
proxy_read_timeout 15s;
|
|
}
|
|
}
|