首先,使用 Google App Engine 构建网站 www.example.com
https://cloud.google.com/products/
其次,将静态图像 example.jpg
上传到 Google Cloud Storage https://cloud.google.com/products/cloud-storage又名 https://developers.google.com/storage/
是否可以将 example.jpg
作为 http://www.example.com/images/example.jpg
提供?而不是使用子域,例如 images.example.com
或 cdn.example.com
等
我想这样做的原因是我想在必要时更轻松地将我的网站移动到 VPS。
最佳答案
我不这么认为,不。单个域名必须路由到 Google Cloud Storage 或 Google App Engine。
请注意,您可以作弊。您可以将您的应用引擎应用配置为接受所有请求,比如“/images/X”并将它们重定向到 images.example.com/X,或者您可以让您的应用从 GCS 读取数据并将其反馈给用户直接来自 App Engine,但这些都不是好的解决方案。
如果您稍后想转移到 VPS,您或许可以将 VPS 配置为处理两个域,一个用于图像,一个用于动态内容。
关于google-app-engine - 是否可以使用一个域的 Google App Engine 在 Google Cloud Storage 上提供静态文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17537123/