Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-middle-front
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-middle-front
Commits
15e2e193
Commit
15e2e193
authored
Nov 13, 2025
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
c2e25e1b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
11 deletions
+67
-11
.env.production
+1
-1
Dockerfile
+1
-1
nginx.conf
+65
-9
No files found.
.env.production
View file @
15e2e193
...
...
@@ -5,7 +5,7 @@ VITE_APP_TITLE = 银盾中台系统
VITE_APP_ENV = 'production'
# 若依管理系统/生产环境
VITE_APP_BASE_API = '/
prod-
api'
VITE_APP_BASE_API = '/api'
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip
Dockerfile
View file @
15e2e193
...
...
@@ -60,5 +60,5 @@ RUN echo "https://mirrors.aliyun.com/alpine/v3.22/main/" > /etc/apk/repositories
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
&&
\
echo
"Asia/Shanghai"
>
/etc/timezone
EXPOSE
6699
EXPOSE
2267
CMD
["nginx", "-g", "daemon off;"]
nginx.conf
View file @
15e2e193
# 定义网关服务的负载均衡组
upstream
gateway_load_balance
{
server
192.168.7.4
:
9010
;
# 管理节点服务器上的网关实例
server
192.168.7.5
:
9011
;
# 工作节点服务器上的网关实例
# 添加负载均衡策略
# least_conn; # 最少连接数
# ip_hash; # IP哈希(需要会话保持时)
}
server
{
listen
6699
;
server_name
139
.224.145.34
;
listen
2267
;
server_name
localhost
;
# 处理前端静态资源(Vue应用)
location
/
{
root
/usr/share/nginx/html
;
index
index.html
;
try_files
$uri
$uri
/
/index.html
;
# 处理Vue路由history模式
if
(
$request_method
=
OPTIONS)
{
# 为静态资源添加CORS头(可选)
add_header
'Access-Control-Allow-Origin'
'*'
always
;
add_header
'Access-Control-Allow-Methods'
'GET,
POST,
PUT,
DELETE,
OPTIONS'
always
;
add_header
'Access-Control-Allow-Headers'
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'
always
;
}
# 代理API请求到网关服务
location
/api/
{
# 负载均衡到两个网关服务实例
proxy_pass
http://gateway_load_balance
;
# 注意:这里不要以斜杠结尾,保留原始路径 /api/xxx
# 如果网关需要去掉 /api 前缀,可以使用:proxy_pass http://gateway_load_balance/;
# 代理设置
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_read_timeout
30s
;
proxy_send_timeout
30s
;
# 缓冲区设置
proxy_buffering
on
;
proxy_buffer_size
4k
;
proxy_buffers
8
4k
;
# CORS 头
add_header
'Access-Control-Allow-Origin'
'*'
always
;
add_header
'Access-Control-Allow-Methods'
'GET,
POST,
PUT,
DELETE,
OPTIONS'
always
;
add_header
'Access-Control-Allow-Headers'
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'
always
;
# 处理OPTIONS请求(CORS预检)
if
(
$request_method
=
'OPTIONS')
{
add_header
'Access-Control-Allow-Origin'
'*'
;
add_header
'Access-Control-Allow-Methods'
'GET,
POST,
PUT,
DELETE,
OPTIONS'
;
add_header
'Access-Control-Allow-Headers'
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'
;
add_header
'Access-Control-Allow-Headers'
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type
,Authorization
'
;
add_header
'Access-Control-Max-Age'
1728000
;
add_header
'Content-Type'
'text/plain
charset=UTF-8'
;
add_header
'Content-Length'
0
;
add_header
'Content-Type'
'text/plain
;
charset=UTF-8'
;
return
204
;
}
}
limit_except
GET
POST
PUT
DELETE
OPTIONS
{
deny
all
;
}
# 健康检查接口
location
/health
{
access_log
off
;
return
200
"healthy
\
n"
;
add_header
Content-Type
text/plain
;
}
}
# 全局方法限制(可选,也可以在每个location中单独设置)
limit_except
GET
POST
PUT
DELETE
OPTIONS
{
deny
all
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment