Files

82 lines
4.0 KiB
Nginx Configuration File
Raw Permalink 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 _;
root /usr/share/nginx/html;
index index.html;
# SPA ve statik dosyalarda API ile aynı temel tarayıcı güvenlik politikaları.
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
add_header X-Frame-Options "DENY" always;
add_header Content-Security-Policy "default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; script-src 'self' https://accounts.google.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com data:; img-src 'self' data: blob: https:; connect-src 'self' https:; worker-src 'self' blob:; frame-src 'self' https://accounts.google.com" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
include /etc/nginx/mime.types;
# Vite, pdf.js worker'ını .mjs uzantısıyla üretiyor; Debian'ın mime.types
# dosyasında mjs yok → application/octet-stream sunuluyordu ve tarayıcı
# modül worker'ını yüklemeyi reddediyordu ("Setting up fake worker failed").
types {
application/javascript mjs;
}
# Canlı veri backend'i (aynı container'da Node, port 3001)
location /api/ {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
# Node and nginx share the same security policy. Keep one canonical
# header value at the edge instead of returning comma-duplicated values.
proxy_hide_header X-Content-Type-Options;
proxy_hide_header Referrer-Policy;
proxy_hide_header Permissions-Policy;
# Belge yükleme: arayüz 10 MB'a izin veriyor, base64 ile ~13,4 MB gövde.
# nginx varsayılanı 1 MB → 1 MB üstü her dosya 413 ile "yüklenemedi" oluyordu.
client_max_body_size 20m;
# Derin şartname analizi 1-2 dk sürebiliyor; 60 sn'de 504 kesiyordu.
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_connect_timeout 10s;
}
# MCP JSON-RPC ucu /api öneki taşımaz. Ayrı proxy olmadan Nginx POST'u
# statik dosya isteği sayıp 405 döndürür ve Node'daki API anahtarı kontrolü
# hiç çalışmaz.
location = /mcp {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_hide_header X-Content-Type-Options;
proxy_hide_header Referrer-Policy;
proxy_hide_header Permissions-Policy;
client_max_body_size 1m;
proxy_read_timeout 60s;
proxy_send_timeout 60s;
proxy_connect_timeout 10s;
}
# Statik varlıklar
location /assets/ {
root /usr/share/nginx/html;
try_files $uri =404;
expires 30d;
# Bu blok kendi add_header direktifini kullandığı için üst seviyedeki
# başlıkları nginx otomatik miras almaz; güvenlik başlıklarını tekrarla.
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
add_header X-Frame-Options "DENY" always;
add_header Content-Security-Policy "default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; script-src 'self' https://accounts.google.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com data:; img-src 'self' data: blob: https:; connect-src 'self' https:; worker-src 'self' blob:; frame-src 'self' https://accounts.google.com" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header Cache-Control "public, no-transform";
}
# SPA yönlendirmesi
location / {
try_files $uri $uri/ /index.html;
}
}