ps: If you want to host permanently, you need to choose a fixed service, such as pinata
, lotus
, Infura
.
Before reading, you should have prepared the site files that need to be hosted.
Upload files
- pinata
If you don't want to sync blocks or download any programs, you can choose to use pinata
for online uploading; but there is a 1GB capacity limit.
- Use
ipfs-desktop
for uploading
Click on Files - Import and select the folder to upload your site.
After uploading the files, you will get a CID. At this time, please do not close the ipfs program. It is currently only uploaded to the local node. You can check the import button next to it after the upload is complete.
You can access it through a public gateway first.
https://ipfs.io/ipfs/replace-with-your-own-CID
ipfs exec
https://github.com/ipfs/ipfs-desktop/releases
Cloudflare IPFS Gateway Configuration
There is a free plan, very considerate.
- Log in to the Cloudflare dashboard.
- Select your account and website.
- Go to Web3 (at the bottom).
- Click on Create Web3 Gateway.
Enter the following information:
Hostname: Enter the hostname to be used as the gateway, it must be a subdomain of the current Cloudflare region. For example (cool.otd.top).
Gateway Description: Enter a description to help distinguish different gateways.
Gateway Type: Choose IPFS DNSLink or Ethereum gateway target. (This article uses the ipfs protocol, so choose DNSLink)
DNSLink: Here, choose the file you want to map. You can refer to the official documentation to resolve DNSLINK, or you can directly write it like this
/ipfs/replace-with-your-own-CID
Then just deploy it.
This is the site I deployed to IPFS hosting
https://cool.otd.top/ (deprecated)
@(cool)