知乎專欄 | 多維度架構 | | | 微信號 netkiller-ebook | | | QQ群:128659835 請註明“讀者” |
預設 IPFS 監聽 127.0.0.1 使用下面命令啟動IPFS守護進程,然後使用 nginx 代理 127.0.0.1
[root@netkiller ~]# hash=$(cat /etc/centos-release | ipfs add -q) [root@netkiller ~]# curl "http://127.0.0.1:8080/ipfs/$hash" CentOS Linux release 7.4.1708 (Core)
Nginx 配置
server { listen 80 default_server; listen [::]:80 default_server; server_name _; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { proxy_pass http://127.0.0.1:8080; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }
[root@netkiller ~]# hash=$(cat /etc/centos-release | ipfs add -q) [root@netkiller ~]# curl "http://localhost/ipfs/$hash" CentOS Linux release 7.4.1708 (Core)
使用瀏覽器訪問檔案
http://localhost/ipfs/QmdoPoadYA5HYvSzgUrgXYdEVRNL1T7pY38GaWabZ3KLgn
ipfs.io 節點
[root@netkiller ~]# hash=$(cat /etc/centos-release | ipfs add -q) [root@netkiller ~]# curl "https://ipfs.io/ipfs/$hash" CentOS Linux release 7.4.1708 (Core)