问题
I am learning google cloud so I tried to deploy my react app there using storage service. For that i created a bucket called travelfrontend and uploaded the files and folders from build folder which is generated when using yarn build
. I do not have any domain so i tried to access from https://storage.googleapis.com/travelfrontend but it shows me the following
I could not make it live. Did I miss anything to make it live?
回答1:
In order to serve the static content generated after running yarn build
you need to set the MainPageSuffix
property on your GCS bucket. This property will cause the file you specify (for example "index.html") to be served when accessing the root URL.
However, the bucket needs to be created and configured as stated in the following "Hosting a static website" docs. Note that you will have to point a custom domain to Cloud Storage by using a CNAME record.
After that, you will be able to set the MainPageSuffix
as stated here
More info about CGS static website configuration can be found here
Hope this helps
来源:https://stackoverflow.com/questions/58947355/xml-is-shown-instead-of-site