mirror of
https://github.com/serty2005/rmser.git
synced 2026-02-04 19:02:33 -06:00
добавил фронт в docker-compose и конфиг для nginx
nginx раздаёт статику из билда реакта порт у фронта - 5174 тк я у себя оставил 5173 на code-server для vite dev
This commit is contained in:
22
rmser-view/nginx.conf
Normal file
22
rmser-view/nginx.conf
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user