52 lines
1.0 KiB
Plaintext
52 lines
1.0 KiB
Plaintext
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 {
|
|
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
|
|
listen <%= @ipfs_external_api_port %> ssl http2;
|
|
<% else -%>
|
|
listen 80;
|
|
<% 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/get {
|
|
proxy_pass http://_ipfs/api/v0/get;
|
|
}
|
|
|
|
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
|
|
ssl_certificate <%= @ssl_cert %>;
|
|
ssl_certificate_key <%= @ssl_key %>;
|
|
<% end -%>
|
|
}
|