добавил фронт в docker-compose и конфиг для nginx

nginx раздаёт статику из билда реакта
порт у фронта - 5174 тк я у себя оставил 5173 на code-server для vite dev
This commit is contained in:
2025-12-11 05:36:35 +03:00
parent 02681340c5
commit 5421bd63bd
3 changed files with 65 additions and 8 deletions

22
rmser-view/nginx.conf Normal file
View File

@@ -0,0 +1,22 @@
server {
listen 80;
server_name localhost;
# 1. Раздача фронтенда
location / {
root /usr/share/nginx/html;
index index.html index.htm;
# Это магия для React Router (SPA): если файл не найден, отдаем index.html
try_files $uri $uri/ /index.html;
}
# 2. Проксирование API на бэкенд
# Запросы на /api/... пойдут в контейнер "app" на порт 8080
location /api/ {
# 'app' - это имя сервиса бэкенда в docker-compose
proxy_pass http://app:8080/api/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}