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 { |
| 19 server_name <% server_name[domain, alt_names] %>; |
| 20 |
| 21 <% if is_default %> |
| 22 listen 80 default_server; |
| 23 listen [::]:80 default_server; |
| 24 <% else %> |
| 25 listen 80; |
| 26 listen [::]:80; |
| 27 <% end %> |
| 28 |
| 29 location / |
| 30 { |
| 31 rewrite (.*) https://$host$1 permanent; |
| 32 } |
| 33 } |
| 34 server |
| 35 { |
| 36 server_name <% server_name[domain, alt_names] %>; |
| 37 |
| 38 <% if is_default %> |
| 39 listen 443 ssl spdy default_server; |
| 40 listen [::]:443 ssl spdy default_server; |
| 41 <% else %> |
| 42 listen 443 ssl spdy; |
| 43 listen [::]:443 ssl spdy; |
| 44 <% end %> |
| 45 |
| 46 ssl_certificate <%= certificate %>; |
| 47 ssl_certificate_key <%= private_key %>; |
| 48 |
| 49 add_header Strict-Transport-Security max-age=31536000; |
| 50 <% else %> |
| 51 server |
| 52 { |
| 53 server_name <% server_name[domain, alt_names] %>; |
| 54 |
| 55 <% if is_default %> |
| 56 listen 80 default_server; |
| 57 listen [::]:80 default_server; |
| 58 <% else %> |
| 59 listen 80; |
| 60 listen [::]:80; |
| 61 <% end %> |
| 62 <% end %> |
| 63 |
| 64 access_log /var/log/nginx/<%= log %> main; |
| 65 |
| 66 # redirect server error pages to the static page /50x.html |
| 67 # |
| 68 error_page 500 502 503 504 /50x.html; |
| 69 location = /50x.html |
| 70 { |
| 71 root /usr/share/nginx/html; |
| 72 } |
| 73 |
| 74 <% if @content %> |
| 75 <%= content %> |
| 76 <% end %> |
| 77 |
| 78 <% if @source %> |
| 79 <% include_file[source] %> |
| 80 <% end %> |
| 81 } |
OLD | NEW |