显示xml而不是网站 [英] xml is shown instead of site

查看:45
本文介绍了显示xml而不是网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习Google Cloud,因此我尝试使用存储服务在此处部署我的React应用.为此,我创建了一个名为travelfrontend的存储桶,并从使用 yarn build 生成的build文件夹上载了文件和文件夹.我没有任何域,因此我尝试从

我无法实现它.我错过了什么让它变得生动吗?

解决方案

为了提供运行 yarn build 之后生成的静态内容,您需要设置 MainPageSuffix 属性在您的GCS存储桶中.此属性将导致在访问根URL时提供您指定的文件(例如"index.html").

但是,需要按照以下托管静态网站"文档.请注意,您将必须使用CNAME记录将自定义域指向Cloud Storage.

此后,您将能够按照此处

有关CGS静态网站配置的更多信息,请参见此处

希望这会有所帮助

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?

解决方案

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

这篇关于显示xml而不是网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆