App Hosting 和其他 Google 解决方案
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
借助 Firebase App Hosting 等无服务器产品,您可以快速部署应用,而无需自行管理基础架构。在 Google 解决方案中,App Hosting 是 Web 开发者在热门框架上创建现代 Web 应用的最佳选择,因为它可管理从 CDN 到服务器端渲染的整个堆栈。
不过,App Hosting 只是 Google 的众多无服务器产品之一。
根据应用的性质或可扩缩性需求,您可以选择 App Hosting 或以下其他产品:
在费用方面,Cloud Run、Cloud Functions 和 Firebase App Hosting 都需要结算账号才能开始使用,并且都包含适用于小型部署的免费层级,价格也都是基于用量。Firebase Hosting 提供免费层级,无需结算账号即可进行小规模部署,并可随着应用规模的扩大灵活扩展。
App Hosting和Firebase Hosting
App Hosting 并非 Firebase Hosting 的直接替代品,而是填补了特定空白。如果您正在开发具有 SSR 的动态服务器渲染 Web 应用,那么 App Hosting 绝对适合您。如果您想为静态网站或单页应用提供托管服务,那么使用原始的 Hosting 来优化成本和性能可能是不错的选择。
由于 App Hosting 和 Firebase Hosting 在支持的功能方面存在一定程度的重叠,因此更详细地了解它们可能会有所帮助。
功能
|
Hosting
|
App Hosting
|
自动部署服务器端渲染的 Web 应用
|
实验性
|
是 |
请求超时
|
1m
|
5 分钟
|
缓存超时
|
1 小时
|
1 小时
|
Stale-While-Revalidate 缓存控制
|
否 |
是 |
服务条款
|
Firebase
|
Cloud
|
静态内容源副本
|
3
|
无
|
动态内容区域
|
3
|
3
|
持续部署
|
受限
|
内置
|
构建流程
|
本地环境
|
可重现的环境
|
预览内容
|
是
|
否 |
容错
|
全球中断
|
区域级服务中断
|
模拟器
|
是 |
是 |
App Hosting 和 Hosting 的开发生命周期功能
Firebase App Hosting 与 GitHub 深度集成,可为您的应用提供高效的生产环境发布。当您将更改推送到实时分支时,App Hosting 会在可重现的 Cloud Build 环境中构建该分支。然后,在 App Hosting 信息中心界面中,您可以将 Web 应用的每个版本与构建时所用的确切提交相关联,从而了解特定时间有哪些更改处于有效状态。
Firebase Hosting 还提供一定程度的集成功能,可使用 GitHub 操作来创建预览渠道,并响应代码库中的操作,在实际渠道中实施部署。
使用 Firebase CLI 中的框架实验部署的应用
对于使用 Firebase CLI 中的框架实验部署到 Firebase Hosting 的现代 Web 应用,我们建议“升级”至 App Hosting。借助 App Hosting,您将获得一个统一的解决方案来管理从 CDN 到服务器端渲染的所有事项,并可享有经过改进的 GitHub 集成。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-08。
[null,null,["最后更新时间 (UTC):2025-08-08。"],[],[],null,["\u003cbr /\u003e\n\nServerless products like Firebase App Hosting let you deploy applications\nfast, without managing the infrastructure yourself. Among Google solutions,\nApp Hosting is the best\nchoice for web developers creating modern web apps on popular\nframeworks because it manages the full stack, from the CDN to server-side\nrendering.\n\nHowever, App Hosting is only one of several Google serverless products.\nDepending on the nature of your app or your scalability needs, you might choose\nApp Hosting or one of these other products:\n\n- **[Cloud Run](https://cloud.google.com/run/docs):** Best for running backend services in containers with maximum configurability.\n- **[Cloud Functions](https://cloud.google.com/functions/docs):** Best for quickly creating single-purpose, event-driven functions.\n- **[Cloud Functions for\n Firebase](/docs/functions)** : Like Cloud Functions, but with a simplified model for easier integration with other Firebase features like Realtime Database or Cloud Firestore.\n- **Firebase App Hosting:** Ideal for hosting modern frameworks-based web apps with server-side rendering (SSR) or generative AI features.\n- **[Firebase Hosting](/docs/hosting):** Excellent for hosting static assets like websites and images.\n\nRegarding cost, Cloud Run, Cloud Functions, and Firebase App Hosting require\na billing account to get started, include a no-cost tier for small deployments,\nand are priced based on usage. Firebase Hosting offers a no-cost tier with\nno billing account required for small deployments, with flexibility to expand as\nyour app scales up.\n\nApp Hosting and Firebase Hosting\n\nApp Hosting is not a drop-in replacement for Firebase Hosting -- it fills\na specific gap. If you are developing a dynamic, server-rendered web app with\nSSR, App Hosting is definitely for you. If you want\nhosting for a static website or single-page app, it may make sense to use the\noriginal Hosting to optimize for cost and performance.\n\nSince App Hosting and Firebase Hosting have a degree of overlap in the\nfeatures they support, a more detailed look may be helpful.\n\n| Feature | Hosting | App Hosting |\n|--------------------------------------------------|-----------------------------------------------------------|-----------------------------------------|\n| Automatic deployment of server-rendered web apps | Experimental | Yes |\n| Request timeout | 1m | 5m |\n| Cache timeout | 1hr | 1hr |\n| Stale-While-Revalidate cache control | No | Yes |\n| Terms of Service | [Firebase](https://firebase.google.com/terms) | [Cloud](https://cloud.google.com/terms) |\n| Static content origin replicas | 3 | N/A |\n| Dynamic content regions | 3 | 3 |\n| Continuous deployment | [Limited](/docs/hosting/github-integration) | Built-in |\n| Build process | Local environment | Reproducible environment |\n| Preview content | [Yes](/docs/hosting/test-preview-deploy#preview-channels) | No |\n| Fault tolerance | Global outage | Regional outage |\n| Emulator | Yes | Yes |\n\nDevelopment lifecycle features of App Hosting and Hosting\n\nFirebase App Hosting is deeply integrated with GitHub and offers efficient\nrollouts to production for your app. When you push a change to your live branch,\nApp Hosting builds the branch in a reproducible Cloud Build environment.\nThen, in the App Hosting dashboard UI, you can track each version of\nyour web app to\nthe exact commit it was built with, so that you know which changes were live at\na certain time.\n\nFirebase Hosting also provides a degree of\n[integration using GitHub actions](/docs/hosting/github-integration)\nto create preview channels and deploy to live channel in response to actions in\na repository.\n\nApps deployed using the frameworks experiment in the Firebase CLI\n\nFor modern web apps deployed to Firebase Hosting using\nthe frameworks experiment in the Firebase CLI, we recommend \"graduating\" to\nApp Hosting. With App Hosting, you'll have a unified solution to\nmanage everything from CDN to server-side rendering, along with improved\nGitHub integration."]]