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
9cd63f5b
Commit
9cd63f5b
authored
Sep 05, 2025
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
91dae4fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
31 deletions
+11
-31
Dockerfile
+1
-1
nginx.conf
+10
-30
No files found.
Dockerfile
View file @
9cd63f5b
...
@@ -60,5 +60,5 @@ RUN echo "https://mirrors.aliyun.com/alpine/v3.22/main/" > /etc/apk/repositories
...
@@ -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
&&
\
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
&&
\
echo
"Asia/Shanghai"
>
/etc/timezone
echo
"Asia/Shanghai"
>
/etc/timezone
EXPOSE
66
66
EXPOSE
66
99
CMD
["nginx", "-g", "daemon off;"]
CMD
["nginx", "-g", "daemon off;"]
nginx.conf
View file @
9cd63f5b
server
{
server
{
listen
66
66
;
listen
66
99
;
server_name
139
.224.145.34
;
server_name
139
.224.145.34
;
# 处理前端静态资源(Vue应用)
# 处理前端静态资源(Vue应用)
location
/
{
location
/
{
root
/usr/share/nginx/html
;
root
/usr/share/nginx/html
;
index
index.html
index.htm
;
index
index.html
;
try_files
$uri
$uri
/
/index.html
;
try_files
$uri
$uri
/
/index.html
;
# 处理Vue路由history模式
if
(
$request_method
=
OPTIONS)
{
# 处理OPTIONS预检请求
if
(
$request_method
=
'OPTIONS')
{
add_header
'Access-Control-Allow-Origin'
'*'
;
add_header
'Access-Control-Allow-Origin'
'*'
;
add_header
'Access-Control-Allow-Methods'
'GET,
POST,
PUT,
DELETE,
OPTIONS'
;
add_header
'Access-Control-Allow-Methods'
'GET,
POST,
PUT,
DELETE,
OPTIONS'
;
add_header
'Access-Control-Allow-Headers'
'DNT,
User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
'
;
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-Max-Age'
1728000
;
add_header
'Access-Control-Max-Age'
1728000
;
add_header
'Content-Type'
'text/plain
;
charset=utf
-8'
;
add_header
'Content-Type'
'text/plain
charset=UTF
-8'
;
add_header
'Content-Length'
0
;
add_header
'Content-Length'
0
;
return
204
;
return
204
;
}
}
# 限制允许的HTTP方法
limit_except
GET
POST
PUT
DELETE
OPTIONS
{
limit_except
GET
POST
PUT
DELETE
OPTIONS
{
deny
all
;
deny
all
;
}
}
...
@@ -27,28 +24,11 @@ server {
...
@@ -27,28 +24,11 @@ server {
# 代理后端API请求 - 使用更具体的路径
# 代理后端API请求 - 使用更具体的路径
location
/api/
{
location
/api/
{
proxy_buffer_size
1024k
;
#设置代理服务器(nginx)保存用户头信息的缓冲区大小
proxy_buffers
16
1024k
;
#proxy_buffers缓冲区,网页平均在32k以下的设置
proxy_busy_buffers_size
2048k
;
#高负荷下缓冲大小(proxy_buffers*2)
proxy_temp_file_write_size
2048k
;
#设定缓存文件夹大小,大于这个值,将从upstream服务器传
proxy_pass
http://139.224.145.34:9002/
;
proxy_pass
http://139.224.145.34:9002/
;
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_buffer_size
1024k
;
proxy_buffers
16
1024k
;
proxy_busy_buffers_size
2048k
;
proxy_temp_file_write_size
2048k
;
# 处理OPTIONS预检请求(确保后端API也支持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,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
;
return
204
;
}
}
}
# 可能需要代理其他后端服务
# 可能需要代理其他后端服务
...
...
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