Published: 26 Dec 2019 › Updated: 26 Dec 2019
IPFS + Nginx提供https / 网络研习社#55
IPFS只能http传输,要有https则必须要有Nginx做反向代理,这两者组合才刚刚好!
- 设置IPFS对外接口
//设置接口
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8085 //访问接口
ipfs config Addresses.API /ip4/127.0.0.1/tcp/9005 //上传接口
- 设置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的!好好设置下,问题解决得都会很顺利!
Leave IPFS + Nginx提供https / 网络研习社#55 to:
Read more #steemjiang posts
Best Posts From lemooljiang
We have not curated any of lemooljiang's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.