了解 Hosting 的用量级别、配额和价格
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Firebase Hosting 的价格取决于项目中以下各项的使用量:
您的 Hosting 配额是项目级的,而非网站级或通道级的。您可以将项目升级到 Blaze 结算方案,以解锁更多付费存储空间和数据传输级别。详细了解 Firebase Hosting 的配额和定价。
我们建议您在 Google Cloud 控制台中为您的项目设置预算提醒。
在 Firebase 控制台中监控 Hosting 存储级别和数据传输级别:
了解 Hosting 存储空间
在将新内容部署到您的网站时,您需要创建一个“发行版本”,即您网站的内容及配置的特定版本。与每个版本关联的文件(包括新版本和保留的所有先前版本)均由 Firebase 存储。这些文件构成了您项目的 Hosting 存储空间用量级别。
此 Hosting 存储空间是独立的,与您的 Firebase 项目的任何其他存储空间(例如 Cloud Storage for Firebase 或数据库存储空间)无关。
请注意,Hosting 针对单独文件设置的大小上限为 2 GB。
Hosting 存储空间的配额
您最多可免费存储 10 GB 的 Hosting 内容。
控制 Hosting 存储空间用量
如需控制您的 Hosting 存储空间用量,您可以执行以下操作:
了解 Hosting 数据传输
当 Hosting 提供您的一项网站资源时,数据会从我们的 CDN 传输到您的最终用户。请求的资源可能已经缓存在 CDN 中(缓存命中),也可能需要从 Hosting 后端提取(缓存未命中)。如果请求的内容可以缓存在 CDN 中,则会被缓存。缓存命中和未命中都会计入项目的 Hosting 数据传输用量。
Hosting 数据传输的配额
每个 Hosting 网站都由我们的全球级 CDN 自动提供免费支持。您每月最多可免费将 10GB 的数据从 CDN 传输给最终用户。
控制 Hosting 数据传输服务用量
如需控制您的 Hosting 数据传输服务用量,您可以执行以下操作:
微调您的内容的客户端缓存,这样浏览器就无需从 CDN 请求资源。如需详细了解缓存,请参阅 Web 开发者文档。
避免加载您实际上不需要显示的图片和视频。
创建 Service Worker 以处理特定请求。
如果您通过预留的 Hosting 网址加载 Firebase SDK,请务必阅读有关为这些网址预留的命名空间的重要信息。
以下资源可帮助您设置 Service Worker(尤其适合 PWA):
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-13。
[null,null,["最后更新时间 (UTC):2025-08-13。"],[],[],null,["\u003cbr /\u003e\n\nThe pricing for Firebase Hosting is based upon your project's usage of the\nfollowing:\n\n- [Hosting storage](#hosting-storage) (GB) --- The amount of storage space\n required to store the content of your Hosting sites (your static files and\n your configuration files).\n\n- [Data transfer](#hosting-data-transfer) (GB/month) --- The amount of data\n transferred to end users from our CDN. Every Hosting site is automatically\n backed by our global CDN at no charge.\n\nYour Hosting quota is project-level, not site-level or channel-level. You\ncan upgrade your project to the Blaze billing plan to unlock additional paid\nstorage and data transfer levels. Learn more about\n[quotas and pricing for Firebase Hosting](/pricing#hosting).\n\nWe recommend setting up\n[budget alerts](/docs/projects/billing/avoid-surprise-bills#set-up-budget-alert-emails)\nfor your project in the Google Cloud console.\n\nMonitor both your Hosting storage level and data transfer level in the\nFirebase console:\n\n- Visit the [*Usage*](//console.firebase.google.com/project/_/hosting/usage)\n dashboard in the *Hosting* section of the console. \n\n You can view the usage levels for different billing periods as well as for all\n your Hosting sites or for each site.\n\n- Visit your project's\n [*Usage and billing* dashboard](//console.firebase.google.com/project/_/usage)\n in the console.\n\n| When your project is on the Blaze pricing plan, [**set up budget alerts**](/docs/projects/billing/avoid-surprise-bills#set-up-budget-alert-emails) using the console. You can use the [Blaze plan calculator](/pricing#blaze-calculator) to estimate your monthly costs.\n|\n| Be aware that **budget alerts do *not* cap your usage or\n| charges** --- they are *alerts* about your costs so that you can\n| take action, if needed. For example, you might consider\n| [using\n| budget notifications to programmatically disable Cloud Billing on a\n| project](https://cloud.google.com/billing/docs/how-to/disable-billing-with-notifications).\n\nUnderstand Hosting storage\n\nWhen you deploy new content to your site, you create a \"release\" that points to\na specific version of content and configuration for your site. The files\nassociated with each release (both new releases and any retained previous\nreleases) are stored by Firebase. These files make up your project's Hosting\nstorage usage level.\n\nThis Hosting storage is independent and unrelated to any other storage for\nyour Firebase project (like Cloud Storage for Firebase or database storage).\n\nNote that Hosting has a maximum size limit of 2 GB for\nindividual files.\n\nQuota for Hosting storage\n\nStorage for your Hosting content is at no cost up to\n10 GB.\n\n- If you are *not* on the Blaze plan, and you reach the\n 10 GB limit of no-cost Hosting storage, you won't be\n able to deploy new content to your sites. You'll need to\n [delete older releases](/docs/hosting/manage-hosting-resources#delete-release)\n or\n [upgrade to the Blaze plan](//console.firebase.google.com/project/_/overview?purchaseBillingPlan=metered).\n\n- If you are on the Blaze plan, and you reach the 10 GB\n limit of no-cost Hosting storage, you'll be billed $0.026 for each additional\n GB of Hosting storage.\n\nControl usage of Hosting storage\n\nTo control your Hosting storage usage, here are some things you can do:\n\n- [Set a limit](/docs/hosting/manage-hosting-resources#release-storage-settings)\n for the number of releases to keep.\n\n- [Manually delete](/docs/hosting/manage-hosting-resources#delete-release)\n specific releases.\n\n- Store larger files using [Cloud Storage for Firebase](/docs/storage), which\n offers a maximum size limit in the terabyte range for individual objects.\n\nUnderstand Hosting data transfer\n\nWhen Hosting serves one of your site's resources, data transfers from our\nCDN to your end user. The requested resource might already be available in our\nCDN cache (a cache hit) or it might need to come from the Hosting backend (a\ncache miss). If the requested content can be cached in the CDN, it will be. Both\ncache hits and misses count toward your project's Hosting data transfer\nusage.\n\nQuota for Hosting data transfer\n\nEvery Hosting site is automatically backed by our global CDN at no charge.\nData transfer from the CDN to your end users is at no cost up to\n10 GB/month.\n\n- If you are *not* on the Blaze plan, and you reach the\n 10 GB/month limit of no-cost data transfer, we\n offer a short grace period but then your sites will be disabled. Your sites\n will remain disabled until the start of the next month because data transfer\n billing is based on *monthly* usage levels. You can reenable your sites\n immediately by [upgrading to the\n Blaze plan](//console.firebase.google.com/project/_/overview?purchaseBillingPlan=metered).\n\n- If you are on the Blaze plan, and you reach the\n 10 GB/month limit of no-cost data transfer, you'll be\n billed $0.15 for each additional GB of data transferred that month.\n\nControl usage of Hosting data transfer\n\nTo control your Hosting data transfer usage, here are some things you can\ndo:\n\n- Fine-tune the client-side caching of your content so that browsers don't need\n to request a resource from the CDN. Learn more about caching in the\n [web developer documentation](//web.dev/http-cache/#cache-control).\n\n- Avoid loading images and videos that you don't actually need to display.\n\n- Create service workers to handle certain requests. \n\n If you load Firebase SDKs via reserved Hosting URLs, make sure to read\n important information about the\n [reserved namespace for these URLs](/docs/hosting/reserved-urls#reserved_urls_and_service_workers).\n\n Here are some resources to help you set up service workers, especially with a\n PWA:\n - Codelab: [Caching files with the service worker](//codelabs.developers.google.com/codelabs/pwa-caching-service-worker/index.html)\n\n - Documentation: [Service Worker Mindset](//web.dev/service-worker-mindset/#powerful-but-limited)"]]