問題:
最近前端vue項目遷移至K8S容器中,因在Nginx非根目錄下頁面下出現空白的問題
現象: 前端系統頁面空白,只有標題欄
nginx容器默認配置:
location / {
root /usr/share/nginx/html;
try_files $uri /index.html;
}
解決:
出處:https://www.cnblogs.com/liucx/
在容器中修改nginx配置
location / {
root /usr/share/nginx/html;
return 200;
}
#新增
location /test{
alias /usr/share/nginx/html;
try_files $uri /test/index.html;
}
希望對您有所幫助