OLD | NEW |
(Empty) | |
| 1 <% include_file = lambda do |url| %> |
| 2 <% content = Puppet::FileServing::Content.indirection.find(url) %> |
| 3 <% if content %> |
| 4 <%= content.content %> |
| 5 <% else %> |
| 6 <% raise StandardError, "Failed to resolve source URL #{url}" %> |
| 7 <% end %> |
| 8 <% end %> |
| 9 |
| 10 <% server_name = lambda do |domain, alt_names| %><%= domain %><% @alt_names.each
do |name| %>, <%= name %><% end %><% end %> |
| 11 |
| 12 <% if global_config %> |
| 13 <%= @global_config %> |
| 14 <% end %> |
| 15 |
| 16 <% if @certificate and @private_key %> |
| 17 server { |
| 18 server_name <% server_name[domain, alt_names] %>; |
| 19 |
| 20 <% if is_default %> |
| 21 listen 80 default_server; |
| 22 listen [::]:80 default_server; |
| 23 <% else %> |
| 24 listen 80; |
| 25 listen [::]:80; |
| 26 <% end %> |
| 27 |
| 28 location / { |
| 29 rewrite (.*) https://$host$1 permanent; |
| 30 } |
| 31 } |
| 32 server { |
| 33 server_name <% server_name[domain, alt_names] %>; |
| 34 |
| 35 <% if is_default %> |
| 36 listen 443 ssl spdy default_server; |
| 37 listen [::]:443 ssl spdy default_server; |
| 38 <% else %> |
| 39 listen 443 ssl spdy; |
| 40 listen [::]:443 ssl spdy; |
| 41 <% end %> |
| 42 |
| 43 ssl_certificate <%= certificate %>; |
| 44 ssl_certificate_key <%= private_key %>; |
| 45 |
| 46 add_header Strict-Transport-Security max-age=31536000; |
| 47 <% else %> |
| 48 server { |
| 49 server_name <% server_name[domain, alt_names] %>; |
| 50 |
| 51 <% if is_default %> |
| 52 listen 80 default_server; |
| 53 listen [::]:80 default_server; |
| 54 <% else %> |
| 55 listen 80; |
| 56 listen [::]:80; |
| 57 <% end %> |
| 58 <% end %> |
| 59 |
| 60 access_log /var/log/nginx/<%= log %> main; |
| 61 |
| 62 <% if @content %> |
| 63 <%= content %> |
| 64 <% end %> |
| 65 |
| 66 <% if @source %> |
| 67 <% include_file[source] %> |
| 68 <% end %> |
| 69 } |
OLD | NEW |