1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
class blog (
String $blog_root,
Hash[String,Hash] $blogs = {},
Optional[String] $domain = undef,
Optional[Array[String]] $domain_aliases = undef,
) {
create_resources(blog::instance, $blogs)
if $domain {
$default = {
access_log => 'absent',
error_log => 'absent',
ssl => true,
ssl_cert => "/etc/letsencrypt/live/${certname}/fullchain.pem",
ssl_key => "/etc/letsencrypt/live/${certname}/privkey.pem",
use_default_location => false,
}
$domain_conf = {
server_name => [ $domain, ],
index_files => [ 'index.php', 'index.html', 'index.htm', ],
www_root => $blog::blog_root,
}
$main_conf = {
"${safe_title} - server" => $default + $domain_conf,
}
create_resources(nginx::resource::server, $main_conf)
if $domain_aliases {
$alias_conf = {
"${safe_title} - aliases" => $default + {
server_name => $domain_aliases,
server_cfg_append => {
'return' => '301 $scheme://blog.hornquist.se$request_uri',
},
},
}
create_resources(nginx::resource::server, $alias_conf)
}
}
}
|