| 知乎专栏 | 多维度架构 | 
默认 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)