Search code examples
google-cloud-sdk

google cloud platform host website, but only working for index.html


I would like to use google cloud platform to host my website (some files with only html and some files with php). But it only shows the index.html page without any images and all the link are not working. I think my app.yaml file is not correct.

Case background:

  • I am using google cloud sdk in my mac.
  • gcloud app deply (this is the command to deploy my website)

Here with app.yaml file:

runtime: php55
api_version: 1

handlers:

- url: /.*
  script: index.html

enter image description here


Solution

  • You need to add static_dir or static_files elements to handlers in your app.yaml.

    Using static_dir, for example:

    runtime: php55
    api_version: 1
    
    handlers:
    
    - url: /
      script: index.html
    - url: /images
      static_dir: images