59 lines
2.2 KiB
Plaintext
59 lines
2.2 KiB
Plaintext
# ── janichat.ru — HTTP → HTTPS redirect (добавить в существующий server 80) ──
|
|
# Добавить в server { listen 80; server_name ... }:
|
|
# server_name ... janichat.ru www.janichat.ru api.janichat.ru;
|
|
|
|
# ── janichat.ru + www — Frontend ─────────────────────────────────────────
|
|
server {
|
|
listen 443 ssl;
|
|
server_name janichat.ru www.janichat.ru;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/janichat.ru/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/janichat.ru/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
|
|
location / {
|
|
proxy_pass http://janichat-frontend:80;
|
|
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;
|
|
}
|
|
}
|
|
|
|
# ── api.janichat.ru — Backend API + WebSocket ─────────────────────────────
|
|
server {
|
|
listen 443 ssl;
|
|
server_name api.janichat.ru;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/api.janichat.ru/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/api.janichat.ru/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
|
|
location /ws {
|
|
proxy_pass http://janichat-api:3000;
|
|
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_read_timeout 86400;
|
|
}
|
|
|
|
location /uploads/ {
|
|
proxy_pass http://janichat-api:3000;
|
|
proxy_set_header Host $host;
|
|
add_header Cache-Control "public, max-age=31536000";
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://janichat-api:3000;
|
|
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;
|
|
}
|
|
}
|