source: darkpeak-services/roles/apache2/templates/apache.vhost.conf.j2 @ 47aa50ab

ansiblekeycloakmatrixpleroma
Last change on this file since 47aa50ab was 47aa50ab, checked in by Mat Booth <mat.booth@…>, 2 years ago

Install the TLS cert key, too

  • Property mode set to 100644
File size: 6.5 KB
Line 
1<VirtualHost *:80>
2    # Force all requests over SSL
3{% if service_name == 'default' %}
4    ServerName {{ domain_name }}
5
6    # Redirect all URLs except the Well-known URLs for certbot/letsencrypt
7    AliasMatch "^/(.well-known/acme-challenge/.*)" "/usr/share/certbot/$1"
8    RedirectMatch ^/((?!\.well-known/acme-challenge/).*)$ https://{{ domain_name }}/$1
9{% else %}
10    ServerName {{ domain }}
11
12    # Redirect all URLs except the Well-known URLs for certbot/letsencrypt
13    AliasMatch "^/(.well-known/acme-challenge/.*)" "/usr/share/certbot/$1"
14    RedirectMatch ^/((?!\.well-known/acme-challenge/).*)$ https://{{ domain }}/$1
15{% endif %}
16</VirtualHost>
17
18<IfModule mod_ssl.c>
19        <VirtualHost _default_:443>
20                ServerAdmin webmaster@{{ domain_name }}
21{% if service_name == 'default' %}
22                # Redirect the bare domain name to the service providing the home page
23                ServerName {{ domain_name }}
24                Redirect / https://{{ redirect_to_service }}.{{ domain_name }}/
25{% else %}
26                ServerName {{ domain }}
27{% endif %}
28                DocumentRoot {{ web_root }}
29
30                ErrorLog ${APACHE_LOG_DIR}/{{ service_name }}/error.log
31                CustomLog ${APACHE_LOG_DIR}/{{ service_name }}/access.log combined
32
33                SSLEngine on
34
35                #   Server Certificate:
36                #   If both key and certificate are stored in the same file, only the
37                #   SSLCertificateFile directive is needed.
38{% if service_name == 'default' %}
39                SSLCertificateFile /etc/ssl/private/{{ domain_name }}.pem
40                SSLCertificateKeyFile /etc/ssl/private/{{ domain_name }}.key
41{% else %}
42                SSLCertificateFile /etc/ssl/private/{{ domain }}.pem
43                SSLCertificateKeyFile /etc/ssl/private/{{ domain }}.key
44{% endif %}
45
46                #   Server Certificate Chain:
47                #   Point SSLCertificateChainFile at a file containing the
48                #   concatenation of PEM encoded CA certificates which form the
49                #   certificate chain for the server certificate. Alternatively
50                #   the referenced file can be the same as SSLCertificateFile
51                #   when the CA certificates are directly appended to the server
52                #   certificate for convinience.
53                #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt
54
55                #   Certificate Authority (CA):
56                #   Set the CA certificate verification path where to find CA
57                #   certificates for client authentication or alternatively one
58                #   huge file containing all of them (file must be PEM encoded)
59                #   Note: Inside SSLCACertificatePath you need hash symlinks
60                #                to point to the certificate files. Use the provided
61                #                Makefile to update the hash symlinks after changes.
62                #SSLCACertificatePath /etc/ssl/certs/
63                #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
64
65                #   Certificate Revocation Lists (CRL):
66                #   Set the CA revocation path where to find CA CRLs for client
67                #   authentication or alternatively one huge file containing all
68                #   of them (file must be PEM encoded)
69                #   Note: Inside SSLCARevocationPath you need hash symlinks
70                #                to point to the certificate files. Use the provided
71                #                Makefile to update the hash symlinks after changes.
72                #SSLCARevocationPath /etc/apache2/ssl.crl/
73                #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl
74
75                #   Client Authentication (Type):
76                #   Client certificate verification type and depth.  Types are
77                #   none, optional, require and optional_no_ca.  Depth is a
78                #   number which specifies how deeply to verify the certificate
79                #   issuer chain before deciding the certificate is not valid.
80                #SSLVerifyClient require
81                #SSLVerifyDepth  10
82
83                #   SSL Engine Options:
84                #   Set various options for the SSL engine.
85                #   o FakeBasicAuth:
86                #        Translate the client X.509 into a Basic Authorisation.  This means that
87                #        the standard Auth/DBMAuth methods can be used for access control.  The
88                #        user name is the `one line' version of the client's X.509 certificate.
89                #        Note that no password is obtained from the user. Every entry in the user
90                #        file needs this password: `xxj31ZMTZzkVA'.
91                #   o ExportCertData:
92                #        This exports two additional environment variables: SSL_CLIENT_CERT and
93                #        SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
94                #        server (always existing) and the client (only existing when client
95                #        authentication is used). This can be used to import the certificates
96                #        into CGI scripts.
97                #   o StdEnvVars:
98                #        This exports the standard SSL/TLS related `SSL_*' environment variables.
99                #        Per default this exportation is switched off for performance reasons,
100                #        because the extraction step is an expensive operation and is usually
101                #        useless for serving static content. So one usually enables the
102                #        exportation for CGI and SSI requests only.
103                #   o OptRenegotiate:
104                #        This enables optimized SSL connection renegotiation handling when SSL
105                #        directives are used in per-directory context.
106                #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
107                <FilesMatch "\.(cgi|shtml|phtml|php)$">
108                        SSLOptions +StdEnvVars
109                </FilesMatch>
110
111                #   SSL Protocol Adjustments:
112                #   The safe and default but still SSL/TLS standard compliant shutdown
113                #   approach is that mod_ssl sends the close notify alert but doesn't wait for
114                #   the close notify alert from client. When you need a different shutdown
115                #   approach you can use one of the following variables:
116                #   o ssl-unclean-shutdown:
117                #        This forces an unclean shutdown when the connection is closed, i.e. no
118                #        SSL close notify alert is send or allowed to received.  This violates
119                #        the SSL/TLS standard but is needed for some brain-dead browsers. Use
120                #        this when you receive I/O errors because of the standard approach where
121                #        mod_ssl sends the close notify alert.
122                #   o ssl-accurate-shutdown:
123                #        This forces an accurate shutdown when the connection is closed, i.e. a
124                #        SSL close notify alert is send and mod_ssl waits for the close notify
125                #        alert of the client. This is 100% SSL/TLS standard compliant, but in
126                #        practice often causes hanging connections with brain-dead browsers. Use
127                #        this only for browsers where you know that their SSL implementation
128                #        works correctly.
129                #   Notice: Most problems of broken clients are also related to the HTTP
130                #   keep-alive facility, so you usually additionally want to disable
131                #   keep-alive for those clients, too. Use variable "nokeepalive" for this.
132                #   Similarly, one has to force some clients to use HTTP/1.0 to workaround
133                #   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
134                #   "force-response-1.0" for this.
135                # BrowserMatch "MSIE [2-6]" \
136                #               nokeepalive ssl-unclean-shutdown \
137                #               downgrade-1.0 force-response-1.0
138
139                # Include service-specific site configuration
140                Include includes/{{ service_name }}.incl.conf
141        </VirtualHost>
142</IfModule>
143
144# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Note: See TracBrowser for help on using the repository browser.