How to Host a website for free with Google Firebase?

0

Firebase is a product from Google Inc. for the app and the web developers to store static files which includes HTML, CSS, JS, PDF etc. and the database. On 21 August 2016, Google announced to discontinue with Google Drive Hosting service which was the easiest and the best means of storing the static files.

Firebase is an alternative to the Google Dive Hosting Service with some advance support and control. Now you can host your website directly with Google Firebase and that’s fully free of cost.

In fact, even me too using the Google Firebase to store some of the static files mainly PDFs and the some small program to let the readers of my blog to download it over CDN powered by the leader of the Internet, Google.

In this article I have detailed the instructions in the simplest way on how to host a website for free with Google Firebase.

Step 1 – Creating an account

Before you proceed make sure you have a Google Account i.e. Gmail. If in case you don’t have any Google account, you can create on for free – all you need to sign up at Gmail.com and login using the account

Once you are ready with your Google account login at console.firebase.google.com and follow the below steps.

Step 2 – Creating a project

Once you are at console.firebase.google.com click on the “Create New Project” button and type the name of your desired project and select your country and click on Create Project. After a successful creation of the project, it will take you on the project management page.

Step 3 – Setting up node.js

After creating the project you are almost ready to host your website with Google Firebase all you need to setup node.js and the Firebase tool in order to manage your files i.e. — uploads and the updates.

To setup node.js log on to nodejs.org/en/ and download the latest node.js and install it. Once you have installed the node.js, follow the next step to integrate the firebase-tool with node.is in order to manage your hosting.

Step 4 – Integrating Firebase with node.js

To begin with downloading the Firebase- tool and the integration process simply launch the node.js command line from Start> All Programs or All Apps in case of windows 10> Node.js> Node.js command prompt. Alternative to this you can simply use the search option to find the node.js command prompt.

Once you are on the console screen of the node.js i.e. the command-line type the following commands to get started with the Google Firebasetool step:

npm install -g firebase-tools

This will download the firebase tool and will install it globally on your PC. Once it is finished with instillation process, run the next line in the same console screen:

firebase login

This command will open your web browser and will ask you to login using your Google account (the same one which you used to create the project) and will also ask you to approve the access to your account.

firebase init

This command will initialize and will also configure your project on your PC. This will also create two files .firebaserc and firebase.json in your account at C:/Users/YOUR_USER_NAME (this will be your default path for the project as well).

Step 5 – Uploading the files and the folders

Before you begin, create a folder and name it “public” and within the public folder add your all the files and folder which you want to upload.

(Also Read: How to Enable Caching with Google Firebase Hosting? )

Attention: The default index file which is serve to the user when he or she access your website is the index.html therefore you should ensure that you have properly create and place the index.html in the root of the public folder.

Once you are done with copy and paste you can run the following command to begin the uploading:

firebase deploy

After uploading the files, you will be able to access your website from YOUR_PROJECT_NAME.firebaseapp.com. You can also use your own domain instead of the sub-domain.firebaseapp.com by simply configure the project to use your Custom Domain. Follow the next step to configure the Firebase to use your custom domain name.

Step 6 – Connecting with Custom Domain

To configure Google Firebase to use your custom domain login to console.firebase.google.com and select the desired project. Once you are on the project page, click on the Hosting> Get Started> Continue> Finish> Connect Custom Domain and follow the below steps:

  • Type your domain name
  • Login into your domain registrars domain management panel
  • Choose the DNS management
  • And change/ add the TXT records as specified in the Google Firebase Project domain configuration screen.

Domain configuration may take 1 minute to 24 hours. In case even after 24 hours you are not able to access your website you can drop your question on my from www.isrg.in

Comments

Loading...