Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-csf-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
yuzhenWang
yd-csf-front
Commits
6d3f134c
Commit
6d3f134c
authored
Dec 04, 2025
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置
parent
e55ab998
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
nginx.conf
+24
-2
No files found.
nginx.conf
View file @
6d3f134c
# 定义网关服务的负载均衡组
# 定义网关服务的负载均衡组
upstream
gateway_load_balance
{
upstream
gateway_load_balance
{
server
139.224.150.79
:
9010
;
# 管理节点服务器上的网关实例
server
139.224.150.79
:
9010
;
# 管理节点服务器上的网关实例
...
@@ -8,16 +9,31 @@ server {
...
@@ -8,16 +9,31 @@ server {
listen
2669
;
listen
2669
;
server_name
_
;
server_name
_
;
# 根目录配置
root
/usr/share/nginx/html
;
index
index.html
;
# 处理404错误,重定向到index.html
error_page
404
=
200
/index.html
;
# 处理前端静态资源(Vue应用)
# 处理前端静态资源(Vue应用)
location
/
{
location
/
{
root
/usr/share/nginx/html
;
index
index.html
;
try_files
$uri
$uri
/
/index.html
;
# 处理Vue路由history模式
try_files
$uri
$uri
/
/index.html
;
# 处理Vue路由history模式
# 为静态资源添加CORS头
# 为静态资源添加CORS头
add_header
'Access-Control-Allow-Origin'
'*'
always
;
add_header
'Access-Control-Allow-Origin'
'*'
always
;
add_header
'Access-Control-Allow-Methods'
'GET,
POST,
PUT,
DELETE,
OPTIONS'
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
;
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
;
# 添加缓存控制
add_header
Cache-Control
"no-cache,
must-revalidate"
;
}
# 静态资源缓存配置
location
~
*
\
.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)
$
{
expires
1y
;
add_header
Cache-Control
"public,
immutable"
;
try_files
$uri
$uri
/
=
404
;
}
}
# 代理API请求到网关服务
# 代理API请求到网关服务
...
@@ -64,4 +80,9 @@ server {
...
@@ -64,4 +80,9 @@ server {
return
200
"healthy
\
n"
;
return
200
"healthy
\
n"
;
add_header
Content-Type
text/plain
;
add_header
Content-Type
text/plain
;
}
}
# 处理undefined路径重定向(修复问题)
location
~
/undefined
{
rewrite
^.*
$
/index.html
break
;
}
}
}
\ 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