Add HTTP redirects for kosmos.chat and kosmos.cash
This commit is contained in:
parent
5e727ec279
commit
1c8ee14bb3
@ -57,6 +57,7 @@
|
|||||||
"kosmos_strfry::nginx",
|
"kosmos_strfry::nginx",
|
||||||
"kosmos_website",
|
"kosmos_website",
|
||||||
"kosmos_website::default",
|
"kosmos_website::default",
|
||||||
|
"kosmos_website::redirects",
|
||||||
"kosmos-akkounts::nginx",
|
"kosmos-akkounts::nginx",
|
||||||
"kosmos-akkounts::nginx_api",
|
"kosmos-akkounts::nginx_api",
|
||||||
"kosmos-bitcoin::nginx_lndhub",
|
"kosmos-bitcoin::nginx_lndhub",
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
"kosmos_strfry::nginx",
|
"kosmos_strfry::nginx",
|
||||||
"kosmos_website",
|
"kosmos_website",
|
||||||
"kosmos_website::default",
|
"kosmos_website::default",
|
||||||
|
"kosmos_website::redirects",
|
||||||
"kosmos-akkounts::nginx",
|
"kosmos-akkounts::nginx",
|
||||||
"kosmos-akkounts::nginx_api",
|
"kosmos-akkounts::nginx_api",
|
||||||
"kosmos-bitcoin::nginx_lndhub",
|
"kosmos-bitcoin::nginx_lndhub",
|
||||||
|
@ -30,6 +30,7 @@ production_run_list = %w(
|
|||||||
kosmos_rsk::nginx_mainnet
|
kosmos_rsk::nginx_mainnet
|
||||||
kosmos_strfry::nginx
|
kosmos_strfry::nginx
|
||||||
kosmos_website::default
|
kosmos_website::default
|
||||||
|
kosmos_website::redirects
|
||||||
kosmos-akkounts::nginx
|
kosmos-akkounts::nginx
|
||||||
kosmos-akkounts::nginx_api
|
kosmos-akkounts::nginx_api
|
||||||
kosmos-bitcoin::nginx_lndhub
|
kosmos-bitcoin::nginx_lndhub
|
||||||
|
35
site-cookbooks/kosmos_website/recipes/redirects.rb
Normal file
35
site-cookbooks/kosmos_website/recipes/redirects.rb
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#
|
||||||
|
# Cookbook:: kosmos_website
|
||||||
|
# Recipe:: redirects
|
||||||
|
#
|
||||||
|
|
||||||
|
redirects = [
|
||||||
|
{
|
||||||
|
domain: "kosmos.chat",
|
||||||
|
target: "https://kosmos.org",
|
||||||
|
http_status: 307
|
||||||
|
},
|
||||||
|
{
|
||||||
|
domain: "kosmos.cash",
|
||||||
|
acme_domain: "letsencrypt.kosmos.org",
|
||||||
|
target: "https://kosmos.org",
|
||||||
|
http_status: 307
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
redirects.each do |redirect|
|
||||||
|
tls_cert_for redirect[:domain] do
|
||||||
|
auth "gandi_dns"
|
||||||
|
acme_domain redirect[:acme_domain] unless redirect[:acme_domain].nil?
|
||||||
|
action :create
|
||||||
|
end
|
||||||
|
|
||||||
|
openresty_site redirect[:domain] do
|
||||||
|
template "nginx_conf_redirect.erb"
|
||||||
|
variables domain: redirect[:domain],
|
||||||
|
target: redirect[:target],
|
||||||
|
http_status: redirect[:http_status],
|
||||||
|
ssl_cert: "/etc/letsencrypt/live/#{redirect[:domain]}/fullchain.pem",
|
||||||
|
ssl_key: "/etc/letsencrypt/live/#{redirect[:domain]}/privkey.pem"
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,20 @@
|
|||||||
|
# Generated by Chef
|
||||||
|
|
||||||
|
server {
|
||||||
|
server_name <%= @domain %>;
|
||||||
|
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
|
||||||
|
access_log <%= node[:openresty][:log_dir] %>/<%= @domain %>.access.log;
|
||||||
|
error_log <%= node[:openresty][:log_dir] %>/<%= @domain %>.error.log warn;
|
||||||
|
|
||||||
|
gzip_static on;
|
||||||
|
gzip_comp_level 5;
|
||||||
|
|
||||||
|
ssl_certificate <%= @ssl_cert %>;
|
||||||
|
ssl_certificate_key <%= @ssl_key %>;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
return <%= @http_status || 301 %> <%= @target %>;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user