-
Notifications
You must be signed in to change notification settings - Fork 4
/
nginx.conf
70 lines (58 loc) · 2.13 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
# nginx -c /code/nginx.conf -g 'daemon off;'
# serveless的nginx配置有点奇怪,gzip不能关闭,gzip_static可以开启,源文件也需要上传,优先使用静态的.gz,没有就动态压缩,不符合压缩标准的采用源文件
events { worker_connections 1024; }
http {
gzip off; # 是否开启动态压缩
gzip_static on; #是否开启静态压缩,默认后缀为.gz
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/html text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png image/svg+xml;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
server {
error_log /dev/stderr;
access_log /dev/stdout;
include /etc/nginx/mime.types;
listen 9000;
## 空html文件
location /empty.html {
root /code;
}
## 微信浏览器访问认证配置
location /b983d603f445c18c471ed1a0b8871c0a.txt {
root /code;
}
## 主应用
location /micromain {
alias /code; # 重命名
index index.html;
# /micromain/(js|css|img|font)/下的带.[hash]_h.文件做强缓存
location ~ "/(js|css|img|font)/.*?\.[a-z0-9]{8}_h\.(js|mjs|css|ttf|woff|woff2|png|jpg|jpeg|webp|gif|svg|ico)$" {
expires 365d;
}
try_files $uri $uri/ /index.html = 404;
}
## vue3子应用
location /vue3/ {
proxy_pass https://env-master-subapp-template-qssunttndw.cn-shenzhen-vpc.fcapp.run/;
}
## vue2+webpack子应用
location /vue2/ {
proxy_pass https://env-master-subapp-template-qssvnttndw.cn-shenzhen-vpc.fcapp.run/;
}
## vue2+vite子应用
location /vue2v/ {
proxy_pass https://env-master-subapp-template-erbbnnrazf.cn-shenzhen-vpc.fcapp.run/;
}
# react18子应用
location /react18/ {
proxy_pass https://env-master-subapp-template-kssqilairq.cn-shenzhen-vpc.fcapp.run/;
}
## 匹配如https://ali-lowcode.lammu.cn,访问这个页面会重定向到/micromain/
location = / {
rewrite .* $scheme://$http_host/micromain/ redirect;
}
}
}