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