Files
tset-antiplagiat/frontend/nginx.conf
jze9 2a14350ee3
Some checks failed
Deploy / deploy (push) Has been cancelled
test build
2026-05-18 01:14:40 +05:00

53 lines
1.5 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;
# Gzip
gzip on;
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
gzip_min_length 1024;
gzip_vary on;
# Cache static assets (JS/CSS с хешами в имени — кешируем надолго)
location ~* \.(js|css|woff2?|ttf|svg|png|jpg|ico)$ {
expires 1y;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
# React SPA — все неизвестные пути → index.html (не кешируем)
location / {
add_header Cache-Control "no-store";
try_files $uri $uri/ /index.html;
}
# Proxy REST API → FastAPI
location /api/ {
proxy_pass http://backend:8000;
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_read_timeout 120s;
proxy_send_timeout 120s;
}
# Proxy WebSocket → FastAPI (/ws/ и /api/admin/ws/)
location ~ ^/(ws/|api/admin/ws/) {
proxy_pass http://backend:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_read_timeout 3600s;
}
# MinIO console
location /minio/ {
proxy_pass http://minio:9001/;
proxy_set_header Host $host;
}
}