Hosting a site for free on IPFS

vasa
vasa
Apr 25, 2018 · 3 min read
today’s centralized storage solutions

This is a short guide, through which you can have your site running for free in few minutes!! So, let’s get started

Prerequisites

no prerequisites found

Step 1: Installing IPFS

I am on a Linux 16.04 LTS system, but if you are a windows user, then life is easy for you(at-least for installation purposes). Just go here and proceed to Step 2. For Mac users, it’s just same as for Linux.

Open up your terminal and execute the code given below.

$ wget https://dist.ipfs.io/go-ipfs/v0.4.14-rc1/go-ipfs_v0.4.14-rc1_linux-amd64.tar.gz
$ tar xf go-ipfs_v0.4.14-rc1_linux-amd64.tar.gz
$ sudo mv go-ipfs/ipfs /usr/local/bin/ipfs
$ ipfs init

Voila. You have a working ipfs node.

Note: you may have to download a different IPFS source if the above version gets outdated.

Step 2: Uploading your site to IPFS network

Now, execute this following command

ipfs daemon

This will start IPFS daemon and connect your local node to IPFS public network.

Now, power up a new terminal(keep the daemon running) and move to the folder of your awesome site. Lets say its name ismy_awesome_site . I have added a file in the directory named index.html .

<!DOCTYPE html>
<html>
<head>
<title>IPFS hosting</title>
</head>
<body>
IPFS hosting
</body>
</html>

Now, execute the following commands while in parent directory of /my_awesome_site .

ipfs add -r my_awesome_site

Your terminal will spit out a set of random strings. This(the hash of your root folder) is your <hash> by which you can access your site. If you wait for few minutes(to get your files pinned in the IPFS network) then you can see your data via the below link

https://ipfs.io/ipfs/<hash>

for eg.

https://ipfs.io/ipfs/QmPY6CvJbehffgcrHVsn8Tm7n66zUpVyQpeU6xM5UvrHvN

Step 3: Forwarding your site to IPFS gateway URL

Pick a web domain and update your forwarding preferences to the IPFS gateway URL (https://ipfs.io/ipfs/<hash>) above like this.

And you are done.

well, it was easy…

If you want to host your website with a domain name, head here:


towardsblockchain

Revolutionzing the business and establishing trust using distributed ledger technology.

vasa

Written by

vasa

Entrepreneur | Co-founder, TowardsBlockChain, an MIT CIC incubated startup | SimpleAsWater, YC 19 | Speaker | https://vaibhavsaini.com

towardsblockchain

Revolutionzing the business and establishing trust using distributed ledger technology.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade