如何在 Amazon S3 上部署两个 Angular5 项目



我们需要在 Amazon S3 上部署两个不同的 Angular5 项目,例如

/assets (folder)
/index.html
/clients (another Angular5 folder)
/clients/assets (folder)
/clients/index.html

例如,我的域名是 https://example.com

现在,当我们尝试使用 https://example.com 访问根索引.html文件时,它工作正常。 但是,当我们尝试访问 https://example.com/clients 时,它会返回错误"错误:无法匹配任何路由。网址细分:"客户端">

还有一件事,我们已经在rootpath index.html上设置了403重定向,因为当客户直接点击URL时,我们需要访问登录页面:https://example.com/login因此,当我尝试访问 https://example.com/clients 时,它会自动重定向到 https://example.com

谁能帮我解决这个问题?

应使用以下命令构建项目:

ng build --base-href /clients/

选项 base-href 表示,您在 Angular 路由之前是什么。

另一方面,您的服务器中可能需要像nginx这样的东西,将请求重定向到不同的项目。

最新更新