class profiles::wiki ( String $wwwroot = '/var/www/wiki/', ) { # TODO letsencrypt for this ensure_packages([ 'vimwiki-scripts', 'xapian-omega', ]) $cert_dir = $facts['letsencrypt_directory'][$::fqdn] nginx::resource::server { "wiki.${::fqdn}": ipv6_enable => true, ipv6_listen_options => '', ssl_redirect => true, ssl => true, ssl_cert => "${cert_dir}/fullchain.pem", ssl_key => "${cert_dir}/privkey.pem", www_root => $wwwroot, use_default_location => false, autoindex => 'on', server_cfg_append => { charset => 'UTF-8', }, } $auth_basic = { auth_basic => '"Please log in"', auth_basic_user_file => '"/var/tmp/htpasswd"', } nginx::resource::location { default: server => "wiki.${::fqdn}", ssl => true, ssl_only => true, ; 'wiki /search': location => '/search', fastcgi_params => 'fastcgi_params', fastcgi_param => { 'SCRIPT_FILENAME' => '/usr/lib/cgi-bin/omega/omega', }, # TODO build fastcgi module, since this path changes between distros fastcgi => 'unix:/run/fcgiwrap.socket', location_cfg_append => $auth_basic, ; 'wiki /private': location => '/private', location_cfg_append => $auth_basic, ; 'wiki /': location => '/', ; } }