解決前端部署到Nginx非根目錄下頁面出現空白的問題


問題:

     最近前端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;
}

 

希望對您有所幫助


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM