It refused to accept connections when the header directive was before the server_name one.
		
			
				
	
	
		
			27 lines
		
	
	
		
			665 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			665 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| # Generated by Chef
 | |
| upstream _<%= @app_name %> {
 | |
|   server   localhost:<%= @nodejs_port %>;
 | |
| }
 | |
| 
 | |
| <% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
 | |
| server {
 | |
|   listen 443 ssl http2;
 | |
|   server_name <%= @server_name %>;
 | |
| 
 | |
|   access_log <%= node[:nginx][:log_dir] %>/<%= @app_name %>.access.log json;
 | |
|   error_log <%= node[:nginx][:log_dir] %>/<%= @app_name %>.error.log warn;
 | |
| 
 | |
|   gzip on;
 | |
| 
 | |
|   add_header Strict-Transport-Security "max-age=15768000";
 | |
| 
 | |
|   location / {
 | |
|     proxy_buffers 1024 8k; # Increase number of buffers. Default is 8
 | |
|     proxy_pass http://_<%= @app_name %>;
 | |
|   }
 | |
| 
 | |
|   ssl_certificate <%= @ssl_cert %>;
 | |
|   ssl_certificate_key <%= @ssl_key %>;
 | |
| }
 | |
| <% end -%>
 |