简体   繁体   中英

issues with deploying hugo site to google cloud app engine

So I'm trying to deploy my Hugo blog to google cloud app engine, but I'm having issue with the URL mapping,I have played with it a lot but nothing seem to work

The home page is working and I can see the the posts but when I click on a post I got error: Not Found message

app.yaml

env: standard
runtime: nodejs16
service: default
handlers:
  - url: /
    static_files: public/index.html
    upload: public/index.html
  - url: /posts
    static_dir: public/posts
  - url: /(.*)
    static_files: public/\1
    upload: public/(.*)

Files structure

在此处输入图像描述

website link: https://www.waelfadlallah.com/


Thank to NoCommandLine the issue is resolved, here is how my app.yaml looks like now

env: standard
runtime: nodejs16
service: default
handlers:
  - url: /posts/(.+)/
    static_files: public/posts/\1/index.html
    upload: public/posts/(.+)/index.html
  - url: /assets
    static_dir: public/assets
  - url: /
    static_files: public/index.html
    upload: public/index.html

See if this works....

Instead of using static_dir , try using static_files and have your handler like the example here . That example has (the sample below). See if you can modify it to suit your pattern

- url: /([^\.]+)([^/])
  static_files: www/\1\2/index.html
  upload: www/(.+)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM