无法访问nginx中的页面

  • 本文关键字:nginx 访问 angular nginx
  • 更新时间 :
  • 英文 :


我正试图在我的angular应用程序中加载中间页面,每次键入的URL如下下面提到:

http://localhost:port/Myproject/test1(默认页面(

http://localhost:port/Myproject/test2

http://localhost:port/Myproject/test3

出现的问题是只加载了第一个页面,而没有加载中间页面(找不到中间屏幕的nginx 404(。我遵循的过程是将dist复制到nginx-html文件夹中。如何解决这个问题。该应用程序使用ng-server命令可以很好地工作,但在部署到nginx服务器后就不能了。

我尝试了stackoverflow的以下选项,但没有结果

try_files $uri $uri/ /index.html;

在nginx default.conf中包含以下内容并重新启动docker对我有效。

try_files$uri$uri//index.html;

最新更新