大屏启动获取视频url,未线上测试
This commit is contained in:
@@ -7,11 +7,47 @@ server {
|
||||
charset utf-8;
|
||||
|
||||
# 设置根目录
|
||||
root /path/to/your/FaceRecognitionWithInsightFace/web_page;
|
||||
root D:/code/python_project/FaceRecognitionWithInsightFace/web_page;
|
||||
|
||||
# 默认首页
|
||||
index index.html monitor_dashboard.html;
|
||||
|
||||
# API代理配置 - 将/api路径路由到后端服务
|
||||
location /api/ {
|
||||
# 后端服务地址(请根据实际情况修改)
|
||||
proxy_pass http://localhost:8000/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;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# 超时设置
|
||||
proxy_connect_timeout 30s;
|
||||
proxy_send_timeout 30s;
|
||||
proxy_read_timeout 30s;
|
||||
|
||||
# 启用WebSocket支持(如果需要)
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# CORS支持
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
|
||||
add_header Access-Control-Allow-Headers "Content-Type, Authorization";
|
||||
|
||||
# 处理预检请求
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
|
||||
add_header Access-Control-Allow-Headers "Content-Type, Authorization";
|
||||
add_header Access-Control-Max-Age 86400;
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
|
||||
# 主页面服务
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
@@ -38,9 +74,9 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# 静态资源目录(如果有的话)
|
||||
# 静态资源目录
|
||||
location /static/ {
|
||||
alias /path/to/your/FaceRecognitionWithInsightFace/web_page/static/;
|
||||
alias D:/code/python_project/FaceRecognitionWithInsightFace/web_page/static/;
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
@@ -49,7 +85,7 @@ server {
|
||||
error_page 404 /404.html;
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
|
||||
# 日志设置
|
||||
access_log /var/log/nginx/monitor_dashboard_access.log;
|
||||
error_log /var/log/nginx/monitor_dashboard_error.log;
|
||||
# 日志设置(Windows路径)
|
||||
access_log logs/monitor_dashboard_access.log;
|
||||
error_log logs/monitor_dashboard_error.log;
|
||||
}
|
||||
Reference in New Issue
Block a user