App Hosting 和其他 Google 解決方案
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Firebase App Hosting 等無伺服器產品可讓您快速部署應用程式,不必自行管理基礎架構。在 Google 解決方案中,App Hosting 是網頁開發人員在熱門架構上建立現代網頁應用程式的最佳選擇,因為這項服務可管理從 CDN 到伺服器端算繪的完整堆疊。
不過,App Hosting 只是 Google 眾多無伺服器產品之一。
視應用程式性質或擴充性需求而定,您可以選擇 App Hosting 或下列其他產品:
就費用而言,您必須擁有帳單帳戶,才能開始使用 Cloud Run、Cloud Functions 和 Firebase App Hosting,且這些服務都提供免費方案,適用於小型部署作業,並根據用量計費。Firebase Hosting 提供免付費層級,適用於小型部署作業,且無需帳單帳戶,可隨著應用程式擴大規模彈性擴充。
App Hosting 和 Firebase Hosting
App Hosting 並非 Firebase Hosting 的替代方案,而是填補特定缺口。如果您要使用 SSR 開發動態、以伺服器算繪的網頁應用程式,App Hosting 絕對是您的最佳選擇。如果您想託管靜態網站或單頁應用程式,建議使用原始 Hosting,以盡量降低成本並提升效能。
由於 App Hosting 和 Firebase Hosting 支援的功能有部分重疊,因此詳細比較兩者或許有助於您做出選擇。
功能
|
Hosting
|
App Hosting
|
自動部署以伺服器算繪的網頁應用程式
|
實驗功能
|
是 |
要求逾時
|
1m
|
5m
|
快取逾時
|
1 小時
|
1 小時
|
Stale-While-Revalidate 快取控制項
|
否 |
是 |
服務條款
|
Firebase
|
Cloud
|
靜態內容來源副本
|
3
|
不適用
|
動態內容區域
|
3
|
3
|
持續部署
|
有限制
|
內建
|
建構程序
|
本機環境
|
可重現的環境
|
預覽內容
|
是
|
否 |
容錯能力
|
全球性服務中斷
|
區域性服務中斷
|
模擬器
|
是 |
是 |
App Hosting 和 Hosting 的開發生命週期功能
Firebase App Hosting 與 GitHub 深度整合,可有效將應用程式推出至正式環境。當您將變更推送至即時分支時,App Hosting 會在可重現的 Cloud Build 環境中建構分支。接著,您可以在 App Hosting 資訊主頁 UI 中,追蹤每個版本的網頁應用程式,瞭解建構時使用的確切提交內容,以便掌握特定時間的變更內容。
Firebase Hosting 也提供使用 GitHub 動作整合的程度,可因應存放區中的動作建立預覽版管道,並部署至正式版管道。
使用 Firebase CLI 中的架構實驗部署的應用程式
對於使用 Firebase CLI 架構實驗部署至 Firebase Hosting 的現代化網頁應用程式,建議「升級」至 App Hosting。有了 App Hosting,您就能透過統一的解決方案管理所有項目,包括 CDN 和伺服器端算繪,並改善 GitHub 整合。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-08 (世界標準時間)。
[null,null,["上次更新時間: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."]]