From efa1f1aeef5d036149088d688792354bc2a3bbe0 Mon Sep 17 00:00:00 2001 From: HotelSync Date: Tue, 17 Mar 2026 01:35:40 +0300 Subject: [PATCH] Fix nginx config: cp.hotelsync.ru routes to hotelsync-cp container MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The actual nginx config lives at /opt/hotelsync/nginx/conf.d/ (outside git). It used container names (hotelsync-*) not docker-compose service aliases. - cp.hotelsync.ru: hotelsync-frontend:80 → hotelsync-cp:80 - app/guest: restored hotelsync-frontend:80 (was broken by accidental sed) - deploy.yml: added step to sync this file from repo to /opt/hotelsync/nginx/conf.d/ Co-Authored-By: Claude Sonnet 4.6 --- .gitea/workflows/deploy.yml | 3 + deploy/nginx/conf.d/hotelsync.conf | 105 ++++++++++++++++++----------- 2 files changed, 67 insertions(+), 41 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index bf7c22d..3dd7a53 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -51,6 +51,9 @@ jobs: hotelsync-cp:latest echo "✅ CP started" + - name: Sync nginx config + run: cp /opt/hotelsync/app/deploy/nginx/conf.d/hotelsync.conf /opt/hotelsync/nginx/conf.d/hotelsync.conf + - name: Reload nginx run: docker exec hotelsync-nginx nginx -s reload diff --git a/deploy/nginx/conf.d/hotelsync.conf b/deploy/nginx/conf.d/hotelsync.conf index 3c22731..1b7e33b 100644 --- a/deploy/nginx/conf.d/hotelsync.conf +++ b/deploy/nginx/conf.d/hotelsync.conf @@ -1,26 +1,8 @@ -# ── Adminer — DB Web UI (port 8080, password protected) ─────────────────── -server { - listen 8080; - server_name _; - - auth_basic "HotelSync Database Admin"; - auth_basic_user_file /etc/nginx/.htpasswd; - - location / { - proxy_pass http://adminer:8080; - 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 300; - } -} - # ── Редирект HTTP → HTTPS ───────────────────────────────────────────────── server { listen 80; - server_name hotelsync.ru www.hotelsync.ru app.hotelsync.ru api.hotelsync.ru git.hotelsync.ru cp.hotelsync.ru; + server_name hotelsync.ru www.hotelsync.ru app.hotelsync.ru api.hotelsync.ru git.hotelsync.ru guest.hotelsync.ru cp.hotelsync.ru; - # Certbot challenge location /.well-known/acme-challenge/ { root /var/www/certbot; } @@ -41,7 +23,7 @@ server { ssl_ciphers HIGH:!aNULL:!MD5; location / { - proxy_pass http://frontend:80; + 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; @@ -49,7 +31,26 @@ server { } } -# ── hotelsync.ru — Лендинг (редирект на app пока нет лендинга) ─────────── +# ── 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; @@ -59,27 +60,11 @@ server { ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers HIGH:!aNULL:!MD5; - location / { - return 302 https://app.hotelsync.ru; - } -} - -# ── 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; + root /var/www/landing; + index index.html; location / { - proxy_pass http://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; + try_files $uri $uri/ /index.html; } } @@ -94,7 +79,45 @@ server { ssl_ciphers HIGH:!aNULL:!MD5; location / { - proxy_pass http://api:3000; + 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;