Create a discourse cookbook that can be wrapped
It makes it possible to serve multiple Discord instances to different hosts from a single nginx load balancer Right now we run one for Kosmos and one for remoteStorage
This commit is contained in:
36
site-cookbooks/discourse/templates/nginx_conf.erb
Normal file
36
site-cookbooks/discourse/templates/nginx_conf.erb
Normal file
@@ -0,0 +1,36 @@
|
||||
# Generated by Chef
|
||||
upstream _<%= @upstream_name %> {
|
||||
<% @upstream_ip_addresses.each do |upstream_ip_address| -%>
|
||||
server <%= upstream_ip_address %>:<%= @upstream_port %>;
|
||||
<% end -%>
|
||||
}
|
||||
|
||||
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
|
||||
server {
|
||||
server_name <%= @server_name %>;
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
ssl_certificate_key <%= @ssl_key %>;
|
||||
|
||||
add_header Strict-Transport-Security "max-age=31536000";
|
||||
|
||||
# Send real IP to the Docker container
|
||||
set_real_ip_from 127.0.0.1;
|
||||
real_ip_header X-Forwarded-For;
|
||||
|
||||
client_max_body_size 20M;
|
||||
|
||||
location / {
|
||||
# Increase number of buffers. Default is 8
|
||||
proxy_buffers 1024 8k;
|
||||
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
|
||||
proxy_pass http://_<%= @upstream_name %>;
|
||||
proxy_http_version 1.1;
|
||||
}
|
||||
}
|
||||
<% end -%>
|
||||
Reference in New Issue
Block a user