upstream _ipfs { server localhost:<%= @ipfs_api_port %>; } <% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%> server { listen <%= @ipfs_external_api_port %> ssl http2; <% else -%> server { listen <%= @ipfs_external_api_port %>; <% end -%> server_name <%= @server_name %>; 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; } location /api/v0/object/get { proxy_pass http://_ipfs/api/v0/object/get; } location /api/v0/object/data { proxy_pass http://_ipfs/api/v0/object/data; } location /api/v0/id { proxy_pass http://_ipfs/api/v0/id; } ssl_certificate <%= @ssl_cert %>; ssl_certificate_key <%= @ssl_key %>; }