Add nginx config with /ws WebSocket location block

Keeps nginx config in repo so WS upgrade headers are not lost on server changes.
The /ws block must appear before location / in api.hotelsync.ru server block.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 19:58:20 +03:00
parent 684073c4ad
commit 5e0c388b3d

135
nginx/conf.d/hotelsync.conf Normal file
View File

@@ -0,0 +1,135 @@
# ── Редирект HTTP → HTTPS ─────────────────────────────────────────────────
server {
listen 80;
server_name hotelsync.ru www.hotelsync.ru app.hotelsync.ru api.hotelsync.ru git.hotelsync.ru guest.hotelsync.ru cp.hotelsync.ru;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
# ── app.hotelsync.ru — Панель управления (React SPA) ─────────────────────
server {
listen 443 ssl;
server_name app.hotelsync.ru;
ssl_certificate /etc/letsencrypt/live/app.hotelsync.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/app.hotelsync.ru/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
proxy_pass http://hotelsync-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;
}
}
# ── guest.hotelsync.ru — Гостевой портал ─────────────────────────────────
server {
listen 443 ssl;
server_name guest.hotelsync.ru;
ssl_certificate /etc/letsencrypt/live/guest.hotelsync.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/guest.hotelsync.ru/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
proxy_pass http://hotelsync-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;
}
}
# ── hotelsync.ru — Лендинг ────────────────────────────────────────────────
server {
listen 443 ssl;
server_name hotelsync.ru www.hotelsync.ru;
ssl_certificate /etc/letsencrypt/live/hotelsync.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/hotelsync.ru/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
root /var/www/landing;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
# ── api.hotelsync.ru — API Backend ────────────────────────────────────────
server {
listen 443 ssl;
server_name api.hotelsync.ru;
ssl_certificate /etc/letsencrypt/live/api.hotelsync.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.hotelsync.ru/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
location /ws {
proxy_pass http://hotelsync-api:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_read_timeout 86400;
}
location / {
proxy_pass http://hotelsync-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;
}
}
# ── cp.hotelsync.ru — Control Panel ──────────────────────────────────────
server {
listen 443 ssl;
server_name cp.hotelsync.ru;
ssl_certificate /etc/letsencrypt/live/cp.hotelsync.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/cp.hotelsync.ru/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
proxy_pass http://hotelsync-cp: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;
}
}
# ── git.hotelsync.ru — Gitea ──────────────────────────────────────────────
server {
listen 443 ssl;
server_name git.hotelsync.ru;
ssl_certificate /etc/letsencrypt/live/git.hotelsync.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/git.hotelsync.ru/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
proxy_pass http://hotelsync-gitea: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;
}
}