72 lines
1.8 KiB
Plaintext
72 lines
1.8 KiB
Plaintext
upstream _ipfs_gateway {
|
|
<% @upstream_hosts.each do |host| %>
|
|
server <%= host %>:<%= @ipfs_gateway_port %>;
|
|
<% end %>
|
|
}
|
|
upstream _ipfs_api {
|
|
<% @upstream_hosts.each do |host| %>
|
|
server <%= host %>:<%= @ipfs_api_port %>;
|
|
<% end %>
|
|
}
|
|
|
|
limit_req_zone $binary_remote_addr zone=ipfsgateway:10m rate=10r/s;
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
|
|
server_name ipfs.kosmos.org;
|
|
|
|
access_log /var/log/nginx/<%= @server_name %>.access.log;
|
|
error_log /var/log/nginx/<%= @server_name %>.error.log;
|
|
|
|
location /ipfs {
|
|
limit_req zone=ipfsgateway burst=20 nodelay;
|
|
proxy_pass http://_ipfs_gateway/ipfs;
|
|
}
|
|
|
|
ssl_certificate /etc/letsencrypt/live/ipfs.kosmos.org/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/ipfs.kosmos.org/privkey.pem;
|
|
}
|
|
|
|
server {
|
|
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
|
|
listen <%= @ipfs_external_api_port %> ssl http2;
|
|
<% else -%>
|
|
listen <%= @ipfs_external_api_port %>;
|
|
<% end -%>
|
|
|
|
server_name <%= @server_name %>;
|
|
|
|
access_log /var/log/nginx/<%= @server_name %>.access.log;
|
|
error_log /var/log/nginx/<%= @server_name %>.error.log;
|
|
|
|
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/api/v0/cat;
|
|
}
|
|
location /api/v0/add {
|
|
proxy_pass http://_ipfs_api/api/v0/add;
|
|
}
|
|
location /api/v0/object/get {
|
|
proxy_pass http://_ipfs_api/api/v0/object/get;
|
|
}
|
|
location /api/v0/object/data {
|
|
proxy_pass http://_ipfs_api/api/v0/object/data;
|
|
}
|
|
location /api/v0/id {
|
|
proxy_pass http://_ipfs_api/api/v0/id;
|
|
}
|
|
|
|
ssl_certificate <%= @ssl_cert %>;
|
|
ssl_certificate_key <%= @ssl_key %>;
|
|
}
|