conf文件配置修复

This commit is contained in:
tianfeng 2026-03-25 14:24:24 +08:00
parent 19a74b15d5
commit 2fa1e60dc4
2 changed files with 35 additions and 1 deletions

View File

@ -1,6 +1,6 @@
FROM registry.cn-hangzhou.aliyuncs.com/public_mirror_images/nginx:1.26.2 FROM registry.cn-hangzhou.aliyuncs.com/public_mirror_images/nginx:1.26.2
COPY dist/ /usr/share/nginx/html/ COPY dist/ /usr/share/nginx/html/
COPY nginx/nginx.conf /etc/nginx/nginx.conf COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/default.conf /etc/nginx/conf.d/default.conf COPY nginx/default-dev.conf /etc/nginx/conf.d/default.conf
EXPOSE 80 EXPOSE 80

34
nginx/default-dev.conf Normal file
View File

@ -0,0 +1,34 @@
server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
# 此处的 @router 实际上是引用下面的转发,否则在 Vue 路由刷新时可能会抛出 404
try_files $uri $uri/ @router;
# 请求指向的首页
index index.html;
}
location /console {
proxy_pass http://console.azizi.svc.cluster.local/console;
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_connect_timeout 30s;
proxy_read_timeout 60s;
proxy_send_timeout 30s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}