为什么我的构建项目 Angular2 在任何 apache 服务器上都不起作用?

Why my build project Angular2 don't work in any apache server?

我在 mac OS Sierra 的本地服务器 apache 中打开我的构建 angular 项目(用 Webpack 弹出),我发现资源有问题index.html 中的文件但是当我在 Ubuntu 项目 运行 中正确地打开相同的构建时没有错误。

I run the build project in the default server Apache on mac OS Sierra 10.12.4 : Result in mac OS Sierra 10.12.4 with default Apache (when I used MAMP PRO in macOS the status of loading files is 404)

When I run the same build project in Ubuntu 16.04 LTS : Result in Ubuntu 16.04 LTS with default Apache

使用的版本:

缺少有效的基本 href,确保 index.html 包含

  <base href=".">

好的,我更改我的 index.html: the result with base href="."

我认为这是不合逻辑的,因为在 Ubuntu 中使用默认基 href="/" 可以正常工作 Old index.html generted with build and work correct in Ubuntu

这解决了我的问题:

https://medium.com/@JohnFoderaro/how-to-set-up-apache-in-macos-sierra-10-12-bca5a5dfffba 我的 apache2 配置中的问题不在基本 href