首页 > 解决方案 > 在 apache 文件夹中部署 Angular 应用程序

问题描述

我有 Apache 服务器,它在/var/www/html/<angular_root>. 我尝试添加一个文件夹/var/www/html/admin/<angular_root>,但出现错误Failed to load resource: the server responded with a status of 404 (Not Found)。你知道我需要实现什么配置吗?

我当前的 apache 配置是:

<Directory /var/www/html/admin>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

标签: angularapache

解决方案


您的角度项目(s base href 是错误的。当您部署应用程序时,请在 cmdline 上指定 base-href :

ng build --prod --base-href ./

供参考https://angular.io/guide/deployment


推荐阅读