Angular9开发的项目如何部署在 nginx apache服务器

Angular9开发的项目如何部署在 nginx apache服务器呢?1、运行 ng build --prod打包项目   2、把dist下面的所有文件复制到你的网站根目录 3、配置伪静态。


下面我们一起看看Angular9程序如何部署在 nginx apache服务器


1.运行 ng build --prod 打包angular项目



2.运行完成 ng build --prod后会在根目录生成dist文件,把dist文件夹中的所有文件复制到您服务器的网站根目录。


3、正常发布angular项目以后会报错,这是因为angualr的路由引起的 ,解决方案就是配置伪静态


可以参考Vue伪静态配置方式:


https://router.vuejs.org/zh/guide/essentials/history-mode.html#%E5%90%8E%E7%AB%AF%E9%85%8D%E7%BD%AE%E4%BE%8B%E5%AD%90



这就是Angular9开发的项目如何部署在 nginx apache服务器的使用方法,Angular9开发的项目如何部署在 nginx apache服务器就给大家先介绍到这里,希望对你有帮助

更多Angular9开发的项目如何部署在 nginx apache服务器的使用教程:https://www.itying.com/goods-1067.html