Services: - api: FastAPI gateway with JWT auth, async endpoints, WebSocket - worker-gpu: CUDA sentence-transformers, FAISS IVFFlat, Ollama LLM - worker-indexer: Winnowing+MinHash plagiarism detection, PDF/DOCX extraction - worker-notifier: SMTP email notifications - worker-gost: GOST 7.1-2003 and GOST R 7.0.5-2008 formatting Infrastructure: - docker-compose.yml (production) + docker-compose.dev.yml (hot reload) - Nginx reverse proxy + WebSocket support - PostgreSQL 16 with Alembic migrations - Elasticsearch 8 with Russian/English analyzers - MinIO, RabbitMQ, Redis, Ollama Frontend: - React 18 + Vite + TypeScript + TailwindCSS + Zustand + React Query v5 - 9 pages: Home, Search, Cabinet, Task, Check, Bibliography, Pricing, Login, Register Scripts: - Parser stubs: OpenAlex, КиберЛенинка, arXiv (Phase 0 - to be filled) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
114 lines
3.8 KiB
Nginx Configuration File
114 lines
3.8 KiB
Nginx Configuration File
# Nginx конфиг для academic.jze9.ru
|
|
# Продакшн: SSL + proxy to FastAPI + React static
|
|
|
|
user nginx;
|
|
worker_processes auto;
|
|
error_log /var/log/nginx/error.log warn;
|
|
pid /var/run/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
# Логи
|
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
'"$http_user_agent"';
|
|
access_log /var/log/nginx/access.log main;
|
|
|
|
sendfile on;
|
|
tcp_nopush on;
|
|
keepalive_timeout 65;
|
|
|
|
# Gzip
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
|
|
gzip_min_length 1024;
|
|
gzip_vary on;
|
|
|
|
# Лимиты
|
|
client_max_body_size 100M;
|
|
proxy_read_timeout 300s;
|
|
proxy_connect_timeout 30s;
|
|
proxy_send_timeout 300s;
|
|
|
|
# Upstream
|
|
upstream api {
|
|
server api:8000;
|
|
keepalive 32;
|
|
}
|
|
|
|
# HTTP → HTTPS редирект
|
|
server {
|
|
listen 80;
|
|
server_name academic.jze9.ru;
|
|
return 301 https://$server_name$request_uri;
|
|
}
|
|
|
|
# HTTPS основной сервер
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name academic.jze9.ru;
|
|
|
|
# SSL (Let's Encrypt)
|
|
ssl_certificate /etc/letsencrypt/live/academic.jze9.ru/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/academic.jze9.ru/privkey.pem;
|
|
|
|
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_cache shared:SSL:10m;
|
|
ssl_session_timeout 1d;
|
|
|
|
# HSTS
|
|
add_header Strict-Transport-Security "max-age=63072000" always;
|
|
|
|
# Security headers
|
|
add_header X-Content-Type-Options nosniff;
|
|
add_header X-Frame-Options DENY;
|
|
add_header X-XSS-Protection "1; mode=block";
|
|
|
|
# ── API proxy ──────────────────────────────────────────────────────────
|
|
location /api/ {
|
|
proxy_pass http://api/api/;
|
|
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_set_header Connection "";
|
|
}
|
|
|
|
# ── WebSocket ──────────────────────────────────────────────────────────
|
|
location /ws/ {
|
|
proxy_pass http://api/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-Real-IP $remote_addr;
|
|
proxy_read_timeout 86400;
|
|
}
|
|
|
|
# ── React SPA (статика) ────────────────────────────────────────────────
|
|
root /var/www/academic;
|
|
index index.html;
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
expires 1d;
|
|
add_header Cache-Control "public, no-transform";
|
|
}
|
|
|
|
# Кэшировать статические ресурсы
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2|woff)$ {
|
|
expires 30d;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
}
|
|
}
|