File: apache2-vhost.conf

package info (click to toggle)
radicale 3.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,688 kB
  • sloc: python: 10,173; javascript: 1,144; sh: 269; xml: 93; makefile: 38; perl: 20
file content (48 lines) | stat: -rw-r--r-- 1,578 bytes parent folder | download | duplicates (4)
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
43
44
45
46
47
48
# example apache2 vhost snippet for Radicale CalDAV/CardDAV service

Define _DOMAIN example.org
Define _HOST event.${_DOMAIN}

# secure-only access to protect password
# assumes already configured TLS certificates and mod-ssl / mod-gnutls
<VirtualHost *:443>
        ServerName ${_HOST}
        ServerAdmin webmaster@${_DOMAIN}
        DocumentRoot /var/www/nowhere

        Include conf-available/radicale-uwsgi.conf

        # authenticate against PAM with mod-authnz-external
        # reusing LocationMatch resolved in radicale snippet
        DefineExternalAuth pwauth pipe /usr/sbin/pwauth
        <LocationMatch "${_RADICALE_LOCATION_MATCH}">
                AuthType Basic
                AuthName "Radicale: Authentication Required"
                AuthBasicProvider external
                AuthExternal pwauth
                AllowOverride None
                Require valid-user
        </LocationMatch>

        ErrorLog ${APACHE_LOG_DIR}/${_HOST}-error.log
        CustomLog ${APACHE_LOG_DIR}/${_HOST}-access.log combined
</VirtualHost>

# insecure access redirects to secure
<VirtualHost *:80>
        ServerName ${_HOST}
        ServerAdmin webmaster@${_DOMAIN}
        DocumentRoot /var/www/nowhere

        # avoid Let's Encrypt validation path
        RedirectMatch permanent ^(?!/.well-known/acme-challenge)(.*) https://${_HOST}/$1

        CustomLog ${APACHE_LOG_DIR}/redirect.log vhost_combined
</VirtualHost>

# cleanup temporary variables
UnDefine _RADICALE_LOCATION_MATCH
UnDefine _RADICALE_APP
UnDefine _RADICALE_PREFIX
UnDefine _HOST
UnDefine _DOMAIN