-
Notifications
You must be signed in to change notification settings - Fork 1
/
nginx.conf
93 lines (85 loc) · 3.07 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
################################################
#### 门户 PC前端主-子项目NGINX统一代理规则 ####
################################################
# nginx配置
server {
listen 8100;
server_name localhost;
gzip on;
gzip_buffers 32 4K;
gzip_comp_level 6;
gzip_min_length 100;
gzip_types application/javascript text/css text/xml;
gzip_disable "MISE [1-6]\.";
gzip_vary on;
# pc端主应用
location / {
add_header Access-Control-Allow-Origin *;
add_header Cache-Control no-cache;
# root 根目录,默认nginx镜像的html文件夹,可以指定其他
root /data/build/nodejs/wocwin-qiankun-v3-main/dist-wocwin-qiankun-v3-main;
index index.html index.htm;
# 如果vue-router使用的是history模式,需要设置这个
try_files $uri $uri/ /index.html;
if ($request_filename ~* ^.*?\.(doc|pdf|docx)$) {
add_header Content-Disposition "attachment";
add_header Content-Type application/octet-stream;
}
}
#### vue2常规模板
location /wocwin-vue2 {
add_header Access-Control-Allow-Origin *;
add_header Cache-Control no-cache;
alias /data/build/nodejs/wocwin-vue2-dev/dist-wocwin-vue2/;
index index.html index.htm;
try_files $uri $uri/ /wocwin-vue2/index.html;
if ($request_filename ~* ^.*?\.(doc|pdf|docx)$) {
add_header Content-Disposition "attachment";
add_header Content-Type application/octet-stream;
}
}
## vue3模板
location /wocwin-admin {
add_header Access-Control-Allow-Origin *;
add_header Cache-Control no-cache;
# root 根目录,默认nginx镜像的html文件夹,可以指定其他
alias /data/build/nodejs/wocwin-admin-dev/dist-wocwin-admin/;
index index.html /index.htm;
# 如果vue-router使用的是history模式,需要设置这个
try_files $uri $uri/ /wocwin-admin/index.html;
if ($request_filename ~* ^.*?\.(doc|pdf|docx)$) {
add_header Content-Disposition "attachment";
add_header Content-Type application/octet-stream;
}
}
#######################
# 转发后端接口
location ^~ /sso/ {
proxy_pass http://*********/sso/; # 统一登录
}
location ^~ /user/ {
proxy_pass http://*********/user/; # 统一用户
}
# 单个子应用业务后台接口地址
location ^~ /mes/ {
proxy_pass http://******/mes/;
}
###############################
### WS转发配置
###############################
# 单个子应用websocket地址
location ^~ /***/ws/ {
proxy_pass http://****/ws/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Real-IP $remote_addr;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/nginx/html;
}
}