init
This commit is contained in:
34
frontend/nginx.conf
Normal file
34
frontend/nginx.conf
Normal file
@@ -0,0 +1,34 @@
|
||||
# nginx.conf
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
# 网站根目录
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
|
||||
# API 反向代理配置
|
||||
# 所有 /api/ 的请求都转发给名为 'backend' 的服务(在 docker-compose.yml 中定义)的 8000 端口
|
||||
location /api/ {
|
||||
proxy_pass http://127.0.0.1:5000/; # 这里的 skit-panel-backend 必须与 docker-compose 中的服务名一致
|
||||
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;
|
||||
}
|
||||
|
||||
# 播放器反向代理 (可选,但推荐,以解决跨域问题)
|
||||
# 假设你的 Node.js 播放器服务在 docker-compose 中名为 skit-panel-player,端口为 3001
|
||||
# location /player/ {
|
||||
# proxy_pass http://skit-panel-player:3001/;
|
||||
# proxy_http_version 1.1;
|
||||
# proxy_set_header Upgrade $http_upgrade;
|
||||
# proxy_set_header Connection "upgrade";
|
||||
# }
|
||||
|
||||
# 处理 Vue Router (SPA) 的路由
|
||||
# 如果请求的文件或目录不存在,则返回 index.html
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user