IPFS + Nginx提供https / 网络研习社#55

in #steemjiang5 years ago

ipfs.jpg

IPFS只能http传输,要有https则必须要有Nginx做反向代理,这两者组合才刚刚好!

  1. 设置IPFS对外接口
//设置接口
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8085  //访问接口
ipfs config Addresses.API /ip4/127.0.0.1/tcp/9005    //上传接口
  1. 设置Nginx反向代理
server {
    server_name  example.com;   
    location / {
        proxy_pass http://127.0.0.1:8085;       
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    listen 8084 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    listen [::]:9004 ssl ipv6only=on; # managed by Certbot
    listen 9004 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    server_name  example.com;
    location / {
        proxy_pass http://127.0.0.1:9005;
     }
}

两者合壁,效果斐然!大家也可以看到SteemJiang在图片上传中使用了IPFS,并且是https的!好好设置下,问题解决得都会很顺利!

Sort:  

Congratulations @lemooljiang! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You published more than 1000 posts. Your next target is to reach 1100 posts.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.16
TRX 0.13
JST 0.027
BTC 60704.04
ETH 2914.62
USDT 1.00
SBD 2.32