chef/site-cookbooks/kosmos-akkounts/templates/nginx_conf_akkounts.erb
2023-07-26 13:31:28 +02:00

52 lines
1.4 KiB
Plaintext

# Generated by Chef
upstream _akkounts {
<% @upstream_hosts.each do |host| %>
server <%= host %>:<%= @upstream_port %>;
<% end %>
}
proxy_cache_path /var/cache/nginx/akkounts levels=1:2
keys_zone=akkounts_cache:10m
max_size=1g inactive=120m use_temp_path=off;
server {
listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2;
listen [::]:443 ssl http2;
server_name <%= @domain %>;
ssl_certificate <%= @ssl_cert %>;
ssl_certificate_key <%= @ssl_key %>;
add_header Strict-Transport-Security "max-age=15768000";
access_log <%= node[:nginx][:log_dir] %>/<%= @domain %>.access.log json;
error_log <%= node[:nginx][:log_dir] %>/<%= @domain %>.error.log warn;
root <%= @root_dir %>;
location ~ ^/(assets|packs|images|javascripts|stylesheets|swfs|system)/ {
access_log off;
gzip_static on;
expires max;
add_header Cache-Control public;
proxy_cache akkounts_cache;
<% if @upstream_hosts.first != "localhost" %>
try_files $uri @proxy;
<% end %>
}
try_files $uri/index.html $uri @proxy;
location @proxy {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect off;
proxy_buffers 1024 8k;
proxy_http_version 1.1;
proxy_pass http://_akkounts;
}
}