59 lines
1.7 KiB
Plaintext
59 lines
1.7 KiB
Plaintext
# Generated by Chef
|
|
upstream _akkounts {
|
|
<% @upstream_hosts.each do |host| %>
|
|
server <%= host %>:<%= @upstream_port %>;
|
|
<% end %>
|
|
}
|
|
|
|
proxy_cache_path <%= node[:openresty][:cache_dir] %>/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 %>;
|
|
|
|
if ($host != $server_name) {
|
|
return 301 $scheme://$server_name$request_uri;
|
|
}
|
|
|
|
ssl_certificate <%= @ssl_cert %>;
|
|
ssl_certificate_key <%= @ssl_key %>;
|
|
|
|
add_header Strict-Transport-Security "max-age=15768000";
|
|
|
|
access_log <%= node[:openresty][:log_dir] %>/<%= @domain %>.access.log json;
|
|
error_log <%= node[:openresty][: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;
|
|
set $x_forwarded_host $http_x_forwarded_host;
|
|
if ($x_forwarded_host = "") { set $x_forwarded_host $host; }
|
|
proxy_set_header X-Forwarded-Host $x_forwarded_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;
|
|
}
|
|
}
|