Set up fail2ban for nginx, move IPFS gateway to proxy role

This commit is contained in:
Râu Cao
2022-11-22 21:16:27 +01:00
parent 7f545404b1
commit d06f5d7723
33 changed files with 1528 additions and 100 deletions

View File

@@ -1,21 +1,27 @@
upstream _ipfs_gateway {
server localhost:<%= @ipfs_gateway_port %>;
<% @upstream_hosts.each do |host| %>
server <%= host %>:<%= @ipfs_gateway_port %>;
<% end %>
}
upstream _ipfs_api {
server localhost:<%= @ipfs_api_port %>;
<% @upstream_hosts.each do |host| %>
server <%= host %>:<%= @ipfs_api_port %>;
<% end %>
}
limit_req_zone $binary_remote_addr zone=ipfsgateway:10m rate=10r/s;
server {
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
listen 443 ssl http2;
listen [::]:443 ssl http2;
<% else -%>
listen 80;
listen [::]:80;
<% end -%>
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;
}
@@ -32,6 +38,9 @@ server {
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;