If you are building server-rendered Angular or Next.js apps, check out next-generation Firebase App Hosting, a full-stack solution for modern web frameworks.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Firebase Hosting
plat_web
Firebase Hosting cung cấp dịch vụ lưu trữ nhanh chóng và an toàn cho ứng dụng web của bạn.
Firebase Hosting là dịch vụ lưu trữ nội dung web cấp độ sản xuất dành cho nhà phát triển.
Chỉ với một lệnh, bạn có thể nhanh chóng triển khai ứng dụng web cho một CDN (mạng phân phối nội dung) toàn cầu.
SSL không cấu hình được tích hợp vào Firebase Hosting, vì vậy nội dung luôn được phân phối một cách an toàn.
Phân phối nội dung nhanh chóng
Mỗi tệp mà bạn tải lên sẽ được lưu vào bộ nhớ đệm trên ổ SSD tại các điểm cuối CDN trên khắp thế giới và được phân phát dưới dạng gzip hoặc Brotli. Chúng tôi sẽ tự động chọn phương thức nén phù hợp nhất cho nội dung của bạn. Nội dung được phân phối nhanh chóng, bất kể người dùng ở đâu.
Mô phỏng và thậm chí chia sẻ các thay đổi trước khi phát hành
Xem và kiểm thử các thay đổi trên một URL được lưu trữ cục bộ, đồng thời tương tác với một phần phụ trợ được mô phỏng.
Chia sẻ nội dung thay đổi với các thành viên trong nhóm bằng URL xem trước tạm thời. Hosting cũng cung cấp tính năng tích hợp GitHub để dễ dàng lặp lại nội dung đã xem trước.
Triển khai phiên bản mới bằng một lệnh
Khi sử dụng CLI Firebase, bạn có thể khởi động và chạy ứng dụng trong vài giây. Các công cụ dòng lệnh cho phép bạn thêm các mục tiêu triển khai vào quy trình xây dựng.
Và nếu bạn cần huỷ triển khai, Hosting sẽ cung cấp tính năng quay lại bằng một lần nhấp.
Tính năng này hoạt động như thế nào?
Cho dù bạn đang triển khai một trang đích ứng dụng đơn giản hay một Ứng dụng web tiến bộ (PWA) phức tạp, Hosting đều cung cấp cho bạn cơ sở hạ tầng, tính năng và công cụ phù hợp với việc triển khai và quản lý trang web cũng như ứng dụng.
Khi sử dụng CLI Firebase, bạn sẽ triển khai các tệp từ thư mục cục bộ trên máy tính sang máy chủ Hosting của chúng tôi. Ngoài việc phân phát nội dung tĩnh, bạn có thể sử dụng Cloud Functions for Firebase hoặc Cloud Run để phân phát nội dung động và lưu trữ các dịch vụ vi mô trên trang web của mình. Tất cả nội dung được phân phát qua kết nối SSL từ máy chủ biên gần nhất trên CDN toàn cầu của chúng tôi.
Bạn cũng có thể
xem và kiểm thử các thay đổi trước khi áp dụng.
Khi sử dụng Firebase Local Emulator Suite, bạn có thể mô phỏng ứng dụng và tài nguyên phụ trợ tại một URL được lưu trữ cục bộ. Bạn cũng có thể chia sẻ các thay đổi của mình tại một URL xem trước tạm thời và thiết lập tính năng tích hợp GitHub để dễ dàng lặp lại trong quá trình phát triển.
Firebase Hosting có các tuỳ chọn cấu hình lưu trữ gọn nhẹ để bạn xây dựng các PWA phức tạp. Bạn có thể dễ dàng ghi đè URL để định tuyến phía máy khách, thiết lập tiêu đề tuỳ chỉnh và thậm chí phân phát nội dung đã bản địa hoá.
Để phân phát nội dung, Firebase cung cấp một số tuỳ chọn miền và miền con:
Theo mặc định, mọi dự án Firebase đều có các miền con miễn phí trên miền web.app và firebaseapp.com. Hai trang web này phân phát cùng một nội dung và cấu hình đã triển khai.
Bạn có thể tạo nhiều trang web nếu có các trang web và ứng dụng liên quan phân phát nội dung khác nhau nhưng vẫn dùng chung các tài nguyên dự án Firebase (ví dụ: nếu bạn có một blog, bảng điều khiển quản trị và ứng dụng công khai).
Firebase tự động cấp chứng chỉ SSL cho tất cả miền của bạn để tất cả nội dung được phân phát một cách an toàn.
Đường dẫn triển khai
Cài đặt CLI Firebase
CLI Firebase giúp bạn dễ dàng thiết lập dự án Hosting mới, chạy máy chủ phát triển cục bộ và triển khai nội dung.
Thiết lập thư mục dự án
Thêm các thành phần tĩnh vào thư mục dự án cục bộ, sau đó chạy firebase init để kết nối thư mục với dự án Firebase.
Trong thư mục dự án cục bộ, bạn cũng có thể thiết lập Cloud Functions hoặc Cloud Run cho nội dung động và dịch vụ vi mô.
Xem, thử nghiệm và chia sẻ các thay đổi trước khi áp dụng (không bắt buộc)
Chạy firebase emulators:start để mô phỏng
Hosting và tài nguyên dự án phụ trợ tại một URL được lưu trữ cục bộ.
Để xem và chia sẻ các thay đổi của bạn tại một URL xem trước tạm thời, hãy chạy firebase hosting:channel:deploy để tạo và triển khai cho một kênh xem trước. Thiết lập tính năng tích hợp GitHub để dễ dàng lặp lại nội dung đã xem trước.
Triển khai trang web
Khi mọi thứ đã ổn, hãy chạy firebase deploy để tải bản tổng quan nhanh mới nhất lên máy chủ của chúng tôi. Nếu cần huỷ triển khai, bạn có thể quay lại chỉ bằng một lần nhấp trong bảng điều khiển Firebase.
Liên kết đến một Ứng dụng web Firebase (không bắt buộc)
Bằng cách liên kết trang web của bạn với một Ứng dụng web Firebase, bạn có thể sử dụng Google Analytics để thu thập dữ liệu về hành vi và mức sử dụng cho ứng dụng của mình, đồng thời sử dụng Firebase Performance Monitoring để hiểu rõ hơn về các đặc điểm hiệu suất của ứng dụng.
Tiếp tục cải thiện trang web của bạn. Kiểm thử cục bộ, chia sẻ các thay đổi tại một URL xem trước tạm thời, sau đó triển khai cho trang web đang hoạt động. Hãy làm theo hướng dẫn từng bước này.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-08-31 UTC."],[],[],null,["Firebase Hosting \nplat_web \nFirebase Hosting provides fast and secure hosting for your web app. \n\nFirebase Hosting is production-grade web content hosting for developers.\nWith a single command, you can quickly deploy web apps to a global CDN (content\ndelivery network).\n\nThough Firebase Hosting is optimized for static and\nsingle-page web apps, you can also [pair Firebase Hosting with\nCloud Functions or Cloud Run](/docs/hosting/serverless-overview) to\nbuild and host dynamic content and microservices on Firebase.\n\n[Get started](/docs/hosting/quickstart)\n\nKey capabilities\n\n|-------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Serve content over a secure connection | Zero-configuration SSL is built into Firebase Hosting, so content is always delivered securely. |\n| Deliver content fast | Each file that you upload is cached on SSDs at CDN edges around the world and served as gzip or Brotli. We auto-select the best compression method for your content. No matter where your users are, the content is delivered fast. |\n| Emulate and even share your changes before going live | View and test your changes on a locally hosted URL and interact with an emulated backend. Share your changes with teammates using temporary preview URLs. Hosting also provides a [GitHub integration](/docs/hosting/github-integration) for easy iterations of your previewed content. |\n| Deploy new versions with one command | Using the Firebase CLI, you can get your app up and running in seconds. Command line tools let you add deployment targets into your build process. And if you need to undo the deploy, Hosting provides one-click rollbacks. |\n\nHow does it work?\n\nWhether you are deploying a simple app landing page or a complex Progressive Web\nApp (PWA), Hosting gives you the infrastructure, features, and tooling\ntailored to deploying and managing websites and apps.\n\nUsing the [Firebase CLI](/docs/cli), you deploy files from local directories\non your computer to our Hosting servers. Beyond serving static content, you\ncan use Cloud Functions for Firebase or Cloud Run to\n[serve dynamic content and host microservices](/docs/hosting/serverless-overview)\non your sites. All content is\nserved over an SSL connection from the closest edge server on our global CDN.\n\nYou can also\n[view and test your changes before going live](/docs/hosting/test-preview-deploy).\nUsing the Firebase Local Emulator Suite,\nyou can emulate your app and backend resources at a locally hosted URL. You can\nalso share your changes at a temporary preview URL and set up a [GitHub\nintegration](/docs/hosting/github-integration) for easy iterations during\ndevelopment.\n\nFirebase Hosting has lightweight\n[hosting configuration options](/docs/hosting/full-config) for you\nto build sophisticated PWAs. You can\neasily rewrite URLs for client-side routing, set up custom headers, and even\nserve localized content.\n\nFor serving your content, Firebase offers several domain and subdomain options:\n\n- By default, every Firebase project has subdomains at no cost on the\n `web.app` and `firebaseapp.com` domains. These two sites serve the same\n deployed content and configuration.\n\n- You can [create multiple sites](/docs/hosting/multisites) if you have\n related sites and apps that serve different content but still share the same\n Firebase project resources (for example if you have a blog, admin panel, and\n public app).\n\n- You can [connect your own domain name](/docs/hosting/custom-domain) to a\n Firebase-hosted site.\n\nFirebase automatically provisions SSL certificates for all your domains so that\nall your content is served securely.\n\nImplementation path\n\n|---|-------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | Install the Firebase CLI | The [Firebase CLI](/docs/cli) makes it easy to set up a new Hosting project, run a local development server, and deploy content. |\n| | Set up a project directory | Add your static assets to a local project directory, then run firebase init to connect the directory to a Firebase project. In your local project directory, you can also set up Cloud Functions or Cloud Run for your [dynamic content and microservices](/docs/hosting/serverless-overview). |\n| | View, test, and share your changes before going live *(optional)* | Run firebase emulators:start to emulate Hosting and your backend project resources at a locally hosted URL. To view and share your changes at a temporary preview URL, run firebase hosting:channel:deploy to create and deploy to a preview channel. Set up the [GitHub integration](/docs/hosting/github-integration) for easy iterations of your previewed content. |\n| | Deploy your site | When things are looking good, run firebase deploy to upload the latest snapshot to our servers. If you need to undo the deploy, you can roll back with just one click in the Firebase console. |\n| | Link to a Firebase Web App *(optional)* | By linking your site to a [Firebase Web App](/docs/web/setup), you can use [Google Analytics](/docs/analytics/get-started?platform=web) to collect usage and behavior data for your app and use [Firebase Performance Monitoring](/docs/perf-mon/get-started-web) to gain insight into the performance characteristics of your app. |\n\nNext steps\n\n- [Get started](/docs/hosting/quickstart) with Firebase Hosting.\n\n- Continue to improve your site. Test locally, share changes at a temporary\n preview URL, then deploy to your live site. Follow this [step-by-step\n guide](/docs/hosting/test-preview-deploy).\n\n- [Build and host microservices](/docs/hosting/serverless-overview) on\n Firebase."]]