- 修改 .env.production 中的 VITE_APP_BASE_API 为 /dev-api - 新增 nginx/default.conf 配置文件,设置 Nginx 服务器配置 - 更新 Dockerfile,使用内部 Nexus 仓库作为 npm registry - 调整 vite.config.ts 中的开发代理端口为 18080
40 lines
1017 B
Plaintext
40 lines
1017 B
Plaintext
server {
|
||
listen 80;
|
||
server_name localhost;
|
||
|
||
#gzip config
|
||
gzip on;
|
||
gzip_buffers 32 4k;
|
||
gzip_comp_level 6;
|
||
gzip_min_length 100;
|
||
gzip_types application/javascript text/css text/xml;
|
||
gzip_disable "MSIE [1-6]\."; #配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持)
|
||
gzip_vary on;
|
||
|
||
location / {
|
||
root /usr/share/nginx/html;
|
||
index index.html index.htm;
|
||
try_files $uri $uri/ /index.html;
|
||
|
||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||
expires 1y;
|
||
add_header Cache-Control "public, immutable";
|
||
}
|
||
}
|
||
|
||
location ~ ^/dev-api/(?<path>.*) {
|
||
proxy_pass http://172.18.0.25:18080/$path$is_args$args;
|
||
|
||
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;
|
||
}
|
||
|
||
location /nginx-health {
|
||
access_log off;
|
||
return 200 "OK";
|
||
add_header Content-Type text/plain;
|
||
}
|
||
}
|