angularjs GCloud错误:错误:您所请求的网址(URL)未找到

hkmswyz6  于 2023-01-12  发布在  Angular
关注(0)|答案(1)|浏览(124)

我按照以下步骤在Google Cloud中部署了我的angular 8应用程序
https://medium.com/@karthiksagar/how-to-deploy-angular-8-app-on-google-cloud-platform-gcp-cdd79e5cc5cf
我的应用程序yaml如下所示

runtime: python27
api_version: 1
threadsafe: true
handlers:
  - url: /
    static_files: sofbox-angular/index.html
    upload: sofbox-angular/index.html
  - url: /
    static_dir: sofbox-angular

我已经将app.yaml文件放在dist/目录中。
我可以访问主URL-http://www.myridemate.com/
但当点击博客时,链接无法访问-http://www.myridemate.com/blog
它给出以下错误
错误:没有找到所请求的网址(URL)无法在此服务器上找到。
尝试在app.yaml中为/blog添加额外的处理程序,但没有成功。
同样的代码在我的本地和hostgator -https://www.myridemate.alexvijayraj.com/blog中也可以使用
不确定我在这里错过了什么。app.yaml或GCP中是否需要一些额外的配置?
App Engine日志中的错误消息:

{
   "time": "2020-09-17T03:58:28.682252Z",
   "severity": "WARNING",
   "logMessage": "Static file referenced by handler not found: sofbox-angular/blog"
}
xwbd5t1u

xwbd5t1u1#

这个帖子中的答案对我很有效。Angular 6 routes not found on Google App Engine
记住删除.yaml文件中已有的两个处理程序(-url:...)

handlers:
    - url: /(.*\.(js|css|svg|png)(|\.map))$
      static_files: dist/\1
      upload: dist/(.*)(|\.map)
    - url: /.*
      static_files: dist/index.html
      upload: dist/.*

相关问题