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.
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Firebase Hosting ti offre un modo rapido, sicuro e affidabile per ospitare le risorse statiche della tua app (HTML, CSS, JavaScript, file multimediali e così via), nonché per pubblicare contenuti dinamici e ospitare microservizi.
Il nostro hosting di livello di produzione è supportato da una rete di distribuzione dei contenuti (CDN) globale. Hosting pubblica i tuoi contenuti tramite SSL per impostazione predefinita e può essere utilizzato con il tuo dominio personalizzato o sui sottodomini del tuo progetto senza costi su web.app e firebaseapp.com.
Per connettere i file del progetto locale al progetto Firebase, esegui il comando
seguente dalla radice della directory del progetto locale:
firebase init hosting
Durante l'inizializzazione del progetto, dai prompt dell'interfaccia a riga di comando di Firebase:
Seleziona un progetto Firebase da connettere alla directory del progetto locale.
Il progetto Firebase selezionato è il progetto Firebase "predefinito" per la tua
directory del progetto locale. Per connettere altri progetti Firebase alla directory del progetto locale, configura gli alias del progetto.
Specifica una directory da utilizzare come directory principale pubblica.
Questa directory contiene tutti i file statici pubblicati pubblicamente, incluso il file
index.html e qualsiasi altro asset che vuoi distribuire su
Firebase Hosting.
La directory principale pubblica predefinita si chiama public.
Puoi specificare la directory principale pubblica ora o puoi
specificarla in un secondo momento nel file di configurazione
firebase.json.
Se selezioni il valore predefinito e non hai ancora una directory chiamata
public, Firebase la crea per te.
Se non hai già un file index.html o 404.html valido nella
directory principale pubblica, Firebase li crea per te.
Al termine dell'inizializzazione, Firebase crea e aggiunge automaticamente due file
alla radice della directory dell'app locale:
Un file di configurazione firebase.json che elenca la configurazione del progetto.
Scopri di più su questo file nella pagina
Configura comportamento hosting.
Per eseguire il deployment sul tuo sito, esegui questo comando dalla radice della directory del progetto locale:
firebase deploy --only hosting
Questo comando esegue il deployment dei contenuti e della configurazione di Hosting nei seguenti
sottodomini di cui è stato eseguito il provisioning di Firebase:
Ora il tuo sito è pronto per essere condiviso con il mondo.
Continua a migliorare il tuo sito. Esegui test in locale, condividi le modifiche a un URL di anteprima temporaneo, quindi esegui il deployment sul tuo sito pubblicato. Segui questa
guida passo passo.
Scopri di più sulle altre funzionalità di hosting:
Consulta la documentazione completa della CLI Firebase.
Preparati a lanciare la tua app:
Configura avvisi
sul budget
per il tuo progetto nella console Google Cloud.
Monitora la dashboard Utilizzo e fatturazione nella console Firebase per avere un quadro generale dell'utilizzo del tuo progetto in più servizi Firebase.
Puoi anche visitare la Hostingdashboard Utilizzo per informazioni più dettagliate sull'utilizzo.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-08-23 UTC."],[],[],null,["\u003cbr /\u003e\n\nFirebase Hosting gives you a fast, secure, and reliable way to host your\napp's static assets (HTML, CSS, JavaScript, media files, etc.) as well as to\n[serve dynamic content and host microservices](/docs/hosting/serverless-overview).\n\nOur production-grade hosting is backed by a global content delivery network\n(CDN). Hosting serves your content over SSL, by default, and can be used\nwith your own [custom domain](/docs/hosting/custom-domain) or on your project's\nsubdomains at no cost on `web.app` and `firebaseapp.com`.\n\nBefore you begin\n\nBefore you can set up Firebase Hosting, you need to\n[create a Firebase project](/docs/web/setup).\n\n**Step 1** : Install the Firebase CLI\n\nVisit the Firebase CLI documentation to learn how to\n[install the CLI](/docs/cli#install_the_firebase_cli) or\n[update to its latest version](/docs/cli#update-cli).\n\n**Step 2**: Initialize your project\n\nTo connect your local project files to your Firebase project, run the following\ncommand from the root of your local project directory: \n\n```\nfirebase init hosting\n```\n\nDuring project initialization, from the Firebase CLI prompts:\n\n1. **Select a Firebase project to connect to your local project directory.**\n\n The selected Firebase project is your \"default\" Firebase project for your\n local project directory. To connect additional Firebase projects to your\n local project directory, set up [project aliases](/docs/cli#project_aliases).\n2. **Specify a directory to use as your public root directory.**\n\n This directory contains all your publicly served static files, including your\n `index.html` file and any other assets that you want to deploy to\n Firebase Hosting.\n - The default for the public root directory is called `public`.\n\n - You can specify your public root directory now or you can\n [specify it later](/docs/hosting/full-config#public) in your\n `firebase.json` configuration file.\n\n - If you select the default and don't already have a directory called\n `public`, Firebase creates it for you.\n\n - If you don't already have a valid `index.html` file or `404.html` file in\n your public root directory, Firebase creates them for you.\n\n3. **Choose a configuration for your site.**\n\n If you select to make a one-page app, then Firebase automatically adds\n [rewrite configurations](/docs/hosting/full-config#rewrites) for you.\n\nAt the end of initialization, Firebase automatically creates and adds two files\nto the root of your local app directory:\n\n- A `firebase.json` configuration file that lists your project configuration.\n Learn more about this file on the\n [configure hosting behavior](/docs/hosting/full-config) page.\n\n- A `.firebaserc` file that stores your\n [project aliases](/docs/cli#project_aliases).\n\n**Step 3**: Deploy to your site\n\nTo deploy to your site, run the following command from the root of your local\nproject directory: \n\n```\nfirebase deploy --only hosting\n```\n| **Note:** By running this command with the `--only hosting` flag, you're only deploying your Hosting content and config. If you *also* want to [deploy other project resources or configurations](/docs/cli#partial_deploys) (like functions or database rules), run this command with a comma-separated list in the flag (for example, `--only hosting,functions`).\n\nThis command deploys your Hosting content and config to the following\nFirebase-provisioned subdomains:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.web.app`\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.firebaseapp.com`\n\nLearn more about\n[deploys and even locally testing your site](/docs/hosting/test-preview-deploy).\n\nNext steps\n\nNow your site is ready to share with the world!\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\n [step-by-step guide](/docs/hosting/test-preview-deploy).\n\n- Learn about further hosting capabilities:\n\n - [Configure hosting behavior](/docs/hosting/full-config)\n - [Connect a custom domain](/docs/hosting/custom-domain)\n - [Serve dynamic content and host microservices](/docs/hosting/serverless-overview)\n- Take a look at the full documentation for the [Firebase CLI](/docs/cli).\n\n- Prepare to launch your app:\n\n\n - Set up [budget\n alerts](/docs/projects/billing/avoid-surprise-bills#set-up-budget-alert-emails) for your project in the Google Cloud console.\n - Monitor the [*Usage and billing*\n dashboard](//console.firebase.google.com/project/_/usage) in the Firebase console to get an overall picture of your project's usage across multiple Firebase services. You can also visit the [Hosting *Usage*\n dashboard](//console.firebase.google.com/project/_/hosting/usage) for more detailed usage information.\n - Review the [Firebase launch checklist](/support/guides/launch-checklist)."]]