chef/site-cookbooks/sockethub/templates/default/nginx_conf_sockethub.erb
Greg Karékinian 29a5947d18 Deploy Sockethub from the npm package
This is currently 3.1.4 and is set as an attribute. The recipe is very
simple now, it installs the npm package, and the systemd service runs
/usr/bin/sockethub and sets the environment variables

Closes #145
2020-03-25 12:43:39 +01:00

43 lines
1.1 KiB
Plaintext

# Generated by Chef
upstream _sockethub {
server localhost:<%= @sockethub_port %>;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
listen <%= @sockethub_external_port %> ssl http2;
add_header Strict-Transport-Security "max-age=15768000";
<% else -%>
listen <%= @sockethub_external_port %>;
<% end -%>
server_name <%= @server_name %>;
access_log <%= node[:nginx][:log_dir] %>/sockethub.access.log json;
error_log <%= node[:nginx][:log_dir] %>/sockethub.error.log warn;
# We might need real ETags, disable those for now
gzip off;
location / {
# Increase number of buffers. Default is 8
proxy_buffers 1024 8k;
proxy_pass http://_sockethub;
proxy_http_version 1.1;
# Enable WebSockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
ssl_certificate <%= @ssl_cert %>;
ssl_certificate_key <%= @ssl_key %>;
<% end -%>
}