Files
Skit-Panel/frontend/nginx.conf
DengDai 519589f8f5 init
2025-12-08 14:45:14 +08:00

35 lines
1.2 KiB
Nginx Configuration File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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;
}
}