I want to share some pdf files on a free website. I do not want to buy a domain name. I do not want to buy a hosting space. I want to use a free space. I do not want to waste my time setting up an http server such as Apache,etc. I know there are many free hosting service providers there. But there is almost no free lunch nowadays. Their space is limited, their features are limited. Some only allow static html files. Some delete your files if no visitors. Some close your account if you do not login for some days. Some close your account if the bandwidth is too high or too low. Most importantly, the sub-domain or free domain they provide is not SEO-friendly, which means your files will not be indexed by google after publishing. Only you know the existence of the files. In the end, you will find using those free hosting services is just wasting your time. After many trials of various free hosting spaces and net drives, I find firebase is the best one that caters for my requirements: stable, has enough storage and the files can be indexed by google. Its almost matches a paid service. Your website would be like https://xxxxx.firebaseapp.com. The files you upload to the website would be https://xxxxx.firebaseapp.com/myfile.pdf. The best of all is the submain performs as well as a paid domain name.
You may be surprised that firebaseapp.com or firebase.com is redirected to https://firebase.google.com. Yes, firebaseapp is now part of google, which means you must have a google account to use firebaseapp. To setup a website and upload files to the website is not as simple as clicking a button, selecting files from a folder on your PC, and clicking an upload button. In fact, setting up a website and uploading files are achieved in a strange way in firebase. After logging in https://firebase.google.com using your google account, you need to go to https://console.firebase.google.com and create a Develop/Hosting project there. But the uploading of files is not performed in the console, you need to download a software called npm from http://nodejs.org/, then install Firebase tools using:
npm install -g firebase-tools
You may wonder where npm installed the firebase-tools. Well, the firebase-tools is actually installed in c:\Users\yourloginname\AppData\Roaming\npm\.
After installing firebase using npm, you need to create a directory on your PC to store the files to be uploaded later. Then open a terminal and cd to that directory, issue
An amazing thing happens, a browser tab is opened to let you login google. After you sign in google, it tells you ” Firebase CLI wants to access your Google Account”. Click the “Allow” button to let it access your google account, then the CLI command exits with successful authentication.
The next firebase cli command you’ll issue(also in your project directory) is:
You’ll be asked to select the firebase cli features for this folder. In our case, we select the feature “Hosting:Configure and deploy Firebase Hosing sites”
You need to specify a project-id(you can find the id of the project you created in console).
Now you need to specify a public folder to store the to-be-uploaded assets. Then you have the option to configure the website as a single-page app(rewrite all urls to /index.html).
Now you’ll find a public folder is created and an index.html is created in this public folder. The firebase command now exits.
It is time to put all your files in the public folder now. Then issue the last firebase cli command:
It will upload all files in the public folder to google. The hosting url will be https://project-id.firebaseapp.com(there is another hosting url https://project-id.web.app for the same website).
If you have a file myfile.pdf in the public folder, you can access it using https://project-id.firebaseapp.com/myfile.pdf
You can modify the default index.html to link to other files in the public folder so they can be seen/indexed by google more easily. Every time you modify/add files in the public folder, you need to run “firebase deploy” in order to sync to the server.
You can log out firebase by:
Next time you update the website on your PC, you can login firebase again and use “firebase deploy” to sync to the server. No need to run “firebase init” any more.
You can see the release history and the usage of your projects in the console. From there, you can see firebase indeed has a limit for the storage(1GB) and bandwidth(10GB) for an account. All your websites share the same quota.