Initial nginx reverse proxy for the IPFS IP
It supports cat and add for now. I have tried it using the ipfs-api npm module
This commit is contained in:
@@ -1,21 +1,45 @@
|
||||
upstream _ipfs {
|
||||
server localhost:<%= @ipfs_api_port %>;
|
||||
}
|
||||
|
||||
# Used by Let's Encrypt (certbot in webroot mode)
|
||||
server {
|
||||
listen 80;
|
||||
server_name <%= @server_name %>;
|
||||
location /.well-known {
|
||||
root "<%= @root_directory %>";
|
||||
}
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80; # For Let's Encrypt
|
||||
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
|
||||
listen 443 ssl spdy;
|
||||
<% else -%>
|
||||
listen 80;
|
||||
<% end -%>
|
||||
|
||||
server_name <%= @server_name %>;
|
||||
|
||||
# Used by Let's Encrypt (certbot in webroot mode)
|
||||
location /.well-known {
|
||||
root "<%= @root_directory %>";
|
||||
}
|
||||
|
||||
location / {
|
||||
return 200 'Nothing to see here';
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
|
||||
# Increase number of buffers. Default is 8
|
||||
proxy_buffers 1024 8k;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
location /api/v0/cat {
|
||||
proxy_pass http://_ipfs/api/v0/cat;
|
||||
}
|
||||
|
||||
location /api/v0/add {
|
||||
proxy_pass http://_ipfs/api/v0/add;
|
||||
}
|
||||
|
||||
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
ssl_certificate_key <%= @ssl_key %>;
|
||||
|
||||
Reference in New Issue
Block a user