Angular2-CloudFoundry上的Nginx路线404错误 [英] Angular2 - Nginx route 404 error on cloudfoundry

查看:70
本文介绍了Angular2-CloudFoundry上的Nginx路线404错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Cloud Foundry平台来部署基于基于Nginx的ststicfile buildpack的angular2应用程序.

I am using cloud foundry platform to deploy angular2 app using nginx based ststicfile buildpack.

在子路由/my-route上刷新时,我得到404. 我希望诸如www.mysite.com/some-ng2-router-path之类的任何路径重定向回www.mysite.com

Upon refreshing on a sub route /my-route I am getting 404. I want any path such as www.mysite.com/some-ng2-router-path to redirect back to www.mysite.com

我已经看到了几篇关于此的文章,但是我不知道如何在服务器上编辑nginx.conf文件,并且我不想使用哈希爆炸方法.

I have seen several posts about this but I can't figure out how to edit the nginx.conf file on the server, and I do not want to use the hash bang approach.

我该怎么办?

谢谢

推荐答案

您是否要在应用中映射路线?例如cf map-route angular-app mysite.com --hostname www --path some-ng2-router-path

Are you trying to map routes within your app? e.g. cf map-route angular-app mysite.com --hostname www --path some-ng2-router-path

有关 https://docs.cloudfoundry的更多信息.org/devguide/deploy-apps/routes-domains.html#map-route

它应与 http://docs.cloudfoundry.org/buildpacks一起使用/staticfile/index.html#pushstate

这篇关于Angular2-CloudFoundry上的Nginx路线404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆