是否可以使用具有一个域的 Google App Engine 在 Google Cloud Storage 上提供静态文件? [英] Is it possible to serve static files on Google Cloud Storage with Google App Engine with one domain?

查看:21
本文介绍了是否可以使用具有一个域的 Google App Engine 在 Google Cloud Storage 上提供静态文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,使用 Google App Engine https 构建网站 www.example.com://cloud.google.com/products/

First, Build a site www.example.com with Google App Engine https://cloud.google.com/products/

二、上传一张静态图片example.jpg到谷歌云存储https://cloud.google.com/products/cloud-storage 又名 https://developers.google.com/storage/

Second, Upload a static image example.jpg to Google Cloud Storage https://cloud.google.com/products/cloud-storage aka https://developers.google.com/storage/

是否可以将 example.jpg 作为 http://www.example.com/images/example.jpg 提供服务?而不是使用子域,例如 images.example.comcdn.example.com

Is it possibe to serve the example.jpg as http://www.example.com/images/example.jpg? instead of using a subdomain such as images.example.com or cdn.example.com etc

我想这样做的原因是因为我想让我的网站在必要时更容易移动到 VPS.

The reason I want to do this is because I want to make it easier to move my site to a VPS when necessary.

推荐答案

我不相信,不.单个域名必须路由到 Google Cloud Storage 或 Google App Engine.

I don't believe so, no. A single domain name must route to either Google Cloud Storage or Google App Engine.

请注意,你可以作弊.您可以将您的应用引擎应用配置为接受所有请求,例如/images/X"并将它们重定向到 images.example.com/X,或者您可以让您的应用从 GCS 读取数据并将其反馈给用户直接来自应用引擎,但这些都不是一个好的解决方案.

You could cheat, mind you. You could configure your app engine app to take all requests for, say "/images/X" and redirect them to images.example.com/X, or you could have your app read the data from GCS and feed it back to the user directly from app engine, but neither of those are a good solution.

如果您以后想迁移到 VPS,您或许可以将 VPS 配置为处理两个域,一个用于图像,一个用于动态内容.

If you wanted to move to a VPS later, you could perhaps configure the VPS to handle two domains, one for images and one for dynamic content.

这篇关于是否可以使用具有一个域的 Google App Engine 在 Google Cloud Storage 上提供静态文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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