不知名提交
This commit is contained in:
74
docker/default.conf
Normal file
74
docker/default.conf
Normal file
@@ -0,0 +1,74 @@
|
||||
server {
|
||||
listen 2323;
|
||||
server_name _;
|
||||
|
||||
# 前端静态文件根目录
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# 日志配置
|
||||
access_log /app/data/logs/access.log;
|
||||
error_log /app/data/logs/error.log;
|
||||
|
||||
# API 请求转发到后端
|
||||
location /api/ {
|
||||
proxy_pass http://127.0.0.1:5002;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
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_cache_bypass $http_upgrade;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_connect_timeout 300s;
|
||||
}
|
||||
|
||||
# 60sapi 静态文件路由
|
||||
location /60sapi/ {
|
||||
alias /usr/share/nginx/html/60sapi/;
|
||||
try_files $uri $uri/ =404;
|
||||
add_header Cache-Control "public, max-age=3600";
|
||||
}
|
||||
|
||||
# smallgame 静态文件路由
|
||||
location /smallgame/ {
|
||||
alias /usr/share/nginx/html/smallgame/;
|
||||
try_files $uri $uri/ =404;
|
||||
add_header Cache-Control "public, max-age=3600";
|
||||
}
|
||||
|
||||
# aimodelapp 静态文件路由
|
||||
location /aimodelapp/ {
|
||||
alias /usr/share/nginx/html/aimodelapp/;
|
||||
try_files $uri $uri/ =404;
|
||||
add_header Cache-Control "public, max-age=3600";
|
||||
}
|
||||
|
||||
# toolbox 静态文件路由
|
||||
location /toolbox/ {
|
||||
alias /usr/share/nginx/html/toolbox/;
|
||||
try_files $uri $uri/ =404;
|
||||
add_header Cache-Control "public, max-age=3600";
|
||||
}
|
||||
|
||||
# 静态资源缓存
|
||||
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# React Router 支持 - 所有其他请求返回 index.html
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
}
|
||||
|
||||
# 健康检查
|
||||
location /health {
|
||||
access_log off;
|
||||
return 200 "healthy\n";
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user