使用nginx啟動angular項目


參考鏈接:https://www.cnblogs.com/kingkangstudy/p/8085642.html

1.下載nginx:http://nginx.org/en/download.html

 

點擊下載即可。

2.將ng build 后的dist里的文件全部拷貝到 nginx的html目錄中,如

3.修改conf文件

 

 在http{....} 中新增一個server

server {
listen 8081;
server_name localhost;
location / {
root D:/mcy/nginx-1.14.0/html/taskmgr;
index index.html;
try_files $uri $uri/ /index.html;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

 

4.運行nginx,然后就可以訪問了.

如:我上面新增的server :http://localhost:8081 即可。

 

ps:

 


免責聲明!

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



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