From: Joe Orton The commit linked in the beginning of the section contains also a bit of code
refactoring so it is not trivial to read during the first pass, but the overall
idea is basically what written up to now. The goal of this section is not to
- cause an headache to the reader trying to read C code, but to put him/her into
+ cause a headache to the reader trying to read C code, but to put him/her into
the right mindset needed to use efficiently the tools offered by the httpd's
filter chain toolset.
There are also companies that offer certificates for web servers free of charge. The pioneer
in this is Let's Encrypt which is a service of the
- Internet Security Research Group (ISRG), a not-for-profit organization to
+ Internet Security Research Group (ISRG), a not-for-profit organization to
"reduce financial, technological, and education barriers to secure communication over the
Internet."
Redirect
RedirectMatch
RedirectPermanent
RedirectRelative
RedirectTemp
ScriptAlias
ScriptAliasMatchRedirect
permanent.
| Description: | Allows relative redirect targets. |
|---|---|
| Syntax: | RedirectRelative OFF|ON |
| Default: | RedirectRelative OFF |
| Context: | server config, virtual host, directory |
| Status: | Base |
| Module: | mod_alias |
| Compatibility: | 2.5.1 and later |
By default, if the target URL of a Redirect
+ directive is a relative URL beginning with a '/' character, the server
+ converts it to a an absolute URL before responding to the client. By
+ setting RedirectRelative to the value "ON",
+ the relative URL is presented to the client directly.
AddAlt* directives.
- Charset keyword allows you to
specify the character set of the generated page. The
@@ -845,8 +844,7 @@ indexing
Last-Modified header on all Unix platforms.
If this is a concern, leave this option disabled.Type keyword allows you to
specify the MIME content-type of the generated page. The default
@@ -864,8 +862,7 @@ indexing
"%d-%b-%Y %H:%M" in 2.4.0. Setting this option
restores the date format from 2.2 and earlier.VersionSort keyword causes files containing
version numbers to sort in a natural way. Strings are sorted as
@@ -892,8 +889,7 @@ indexing
XHTML keyword forces mod_autoindex
to emit XHTML 1.0 code instead of HTML 3.2.
diff --git a/docs/manual/mod/mod_http2.html.en b/docs/manual/mod/mod_http2.html.en
index 0a3998ad654..3ffbce7ec80 100644
--- a/docs/manual/mod/mod_http2.html.en
+++ b/docs/manual/mod/mod_http2.html.en
@@ -770,7 +770,7 @@ H2PushPriority text/css interleaved # weight 256 default
| Description: | |
|---|---|
| Description: | Configure the number of seconds of idle time on TLS before shrinking writes |
| Syntax: | H2TLSCoolDownSecs seconds |
| Default: | H2TLSCoolDownSecs 1 |
| Context: | server config, virtual host |
| Description: | |
|---|---|
| Description: | Configure the number of bytes on TLS connection before doing max writes |
| Syntax: | H2TLSWarmUpSize amount |
| Default: | H2TLSWarmUpSize 1048576 |
| Context: | server config, virtual host |
Controls if the base server, the one outside all VirtualHosts should be managed by
- mod_md or not. Default is to not do this, for the very reason that
+ mod_md or not. By default, it will not. For the very reason that
it may have confusing side-effects. It is recommended that you have virtual hosts
for all managed domains and do not rely on the global, fallback server configuration.
| Description: | Type of ACME challenge used to prove domain ownership. |
|---|---|
| Syntax: | MDCAChallenges name [ name ... ] |
| Default: | MDCAChallenges tls-sni-01 http-01 |
| Default: | MDCAChallenges tls-alpn-01 http-01 dns-01 |
| Context: | server config |
| Status: | Experimental |
| Module: | mod_md |
| Description: | The URL of the Terms-of-Service document, that the CA server requires you to accept. |
|---|---|
| Syntax: | MDCertificateAgreement url-of-terms-of-service |
| Description: | You confirm that you accepted the Terms of Service of the Certificate + Authority. |
| Syntax: | MDCertificateAgreement accepted |
| Context: | server config |
| Status: | Experimental |
| Module: | mod_md |
When you use mod_md to obtain a certificate, you become a customer of the CA (e.g. Let's Encrypt). That means you need to read and agree to their Terms of Service,
+
When you use mod_md to obtain a certificate, you become a customer of the CA (e.g. Let's Encrypt). That means you need to read and agree to their Terms of Service,
so that you understand what they offer and what they might exclude or require from you.
- mod_md cannot, by itself, agree to such a thing.
+ mod_md cannot, by itself, agree to such a thing.
In case of Let's Encrypt, their current Terms of Service are here. - Those terms might (and probably will) change over time. So, the certificate renewal might require you to update this agreement URL.
-MDCertificateAgreement https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf -MDomain example.org www.example.org mail.example.org-
| Description: | The URL of the ACME Certificate Authority service. |
|---|---|
| Syntax: | MDCertificateAuthority url |
| Default: | MDCertificateAuthority https://acme-v01.api.letsencrypt.org/directory |
| Default: | MDCertificateAuthority https://acme-v02.api.letsencrypt.org/directory |
| Context: | server config |
| Status: | Experimental |
| Module: | mod_md |
| Description: | Specify a static certificate file for the MD. |
|---|---|
| Syntax: | MDCertificateFile path-to-pem-file |
| Context: | server config |
| Status: | Experimental |
| Module: | mod_md |
+ This is used inside a MDomainSet and specifies
+ the file holding the certificate chain for the Managed Domain. The matching
+ key is specified via MDCertificateKeyFile.
+
<MDomain mydomain.com> + MDCertificateFile /etc/ssl/my.cert + MDCertificateKeyFile /etc/ssl/my.key +</MDomain>+
+ This is that equivalent of the mod_ssl
+ SSLCertificateFile directive. It
+ has several uses.
+
+ If you want to migrate an existing domain, using static files, to
+ automated Let's Encrypt certificates, for one. You define the
+ MDomainSet, add the files here and remove
+ the SSLCertificateFile from
+ your VirtualHosts.
+
+ This will give you the same as before, with maybe less repeating lines
+ in your configuration. Then you can add MDRenewMode
+ 'always' to it and the module will get a new certificate before
+ the one from the file expires. When it has done so, you remove the
+ MDCertificateFile and reload the server.
+
+ Another use case is that you renew your Let's Encrypt certificates with + another ACME clients, for example the excellent + certbot. Then let your MDs point + to the files from certbot and have both working together. +
+ +| Description: | Specify a static private key for for the static cerrtificate. |
|---|---|
| Syntax: | MDCertificateKeyFile path-to-file |
| Context: | server config |
| Status: | Experimental |
| Module: | mod_md |
+ This is used inside a MDomainSet and specifies
+ the file holding the private key for the Managed Domain. The matching
+ certificate is specified via MDCertificateFile.
+
+ This is that equivalent of the mod_ssl
+ SSLCertificateKeyFile directive.
+
Specifies the protocol to use. Currently, only ACME is supported.
+ Specifies the protocol to use. Currently, only ACME is supported.
+
| Description: | Exposes public certificate information in JSON. |
|---|---|
| Syntax: | MDCertificateStatus on|off |
| Default: | MDCertificateStatus on |
| Context: | server config |
| Status: | Experimental |
| Module: | mod_md |
+ When enabled, a resources is available in Managed Domains at + 'https://domain/.httpd/certificate-status' that returns a JSON + document list key properties of the current and of a renewed + certificate - when available. +
+{
+ "valid-until": "Thu, 29 Aug 2019 16:06:35 GMT",
+ "valid-from": "Fri, 31 May 2019 16:06:35 GMT",
+ "serial": "03039C464D454EDE79FCD2CAE859F668F269",
+ "sha256-fingerprint": "1ff3bfd2c7c199489ed04df6e29a9b4ea6c015fe8a1b0ce3deb88afc751e352d"
+ "renewal" : { ...renewed cert information... }
+}
+| Description: | |
|---|---|
| Syntax: | MDChallengeDns01 path-to-command |
| Context: | server config |
| Status: | Experimental |
| Module: | mod_md |
+ Define a program to be called when the `dns-01` challenge needs to be setup/torn down. + The program is given the argument `setup` or `teardown` followed by the domain name. + For `setup` the challenge content is additionally given. +
+ You do not need to specify this, as long as a 'http:' or 'https:' challenge + method is possible. However, Let's Encrypt makes 'dns-01' the only + challenge available for wildcard certificates. If you require + one of those, you need to configure this. +
+ See the section about wildcard certificates above for more details. +
| Description: | Control when it is allowed to obtain/renew certificates. |
|---|---|
| Description: | former name of MDRenewMode. |
| Syntax: | MDDriveMode always|auto|manual |
| Default: | MDDriveMode auto |
| Context: | server config |
| Status: | Experimental |
| Module: | mod_md |
In 'auto' mode, mod_md will drive a Managed Domain's
- properties (e.g. certificate management) whenever necessary. When a MD is not used
- in any virtual host, the module will do nothing. When a certificate is missing, it
- will try to get one. When a certificate expires soon (see
- MDRenewWindow), it will
- renew it.
-
- In 'manual' mode, it is your duty to do all this. The module will provide the existing
- certificate to mod_ssl, if available. But it will not contact the CA for signup/renewal.
- This can be useful in clustered setups where you want just one node to perform
- the driving.
-
- The third mode 'always' is like 'auto', with the difference that
- mod_md will not check if the MD is actually used.
+
This directive exists for backward compatibility as the old name for
+ MDRenewMode.
Instead of listing all dns names on the same line, you may use
- MDMember to add such names
+ MDMember to add such names
to a managed domain.
<MDomainSet example.org> +Example
<MDomain example.org> MDMember www.example.org MDMember mail.example.org -</MDomainSet example.org>+</MDomain>If you use it in the global context, outside a specific MD, you can only @@ -306,6 +531,46 @@ MDCertificateAgreement https://letsencrypt.org/documents/LE-SA-v1.2-November-15- are automatically added to the members of a Managed Domain or not.
+
| Description: | Handle events for Manage Domains |
|---|---|
| Syntax: | MDMessageCmd path-to-cmd optional-args |
| Context: | server config |
| Status: | Experimental |
| Module: | mod_md |
+ This command gets called when one of the following events happen for + a Managed Domain: "renewed", "expiring", "errored". The command may + be invoked for more than these in the future and ignore events + it is not prepared to handle. +
+ This is the more flexible companion to MDNotifyCmd.
+
+MDMessageCmd /etc/apache/md-message
+
+# will be invoked when a new certificate for mydomain.org is available as:
+/etc/apache/md-message renewed mydomain.com
+
++
+ The program should not block, as the module will wait for it to finish. A + return code other than 0 is regarded as an error. +
+ 'errored' is no immediate cause for concern since renewal is attempted + early enough to allow the internet to come back. +
+ 'expiring' should be taken serious. It is issued when the
+ MDWarnWindow is reached. By default this is
+ 10% of the certificate lifetime, so for Let's Encrypt this currently
+ means 9 days before it expires. The warning is repeated at most once
+ a day.
+
| Description: | Run a program when Managed Domain are ready. |
|---|---|
| Description: | Run a program when a Managed Domain is ready. |
| Syntax: | MDNotifyCmd path [ args ] |
| Context: | server config |
| Status: | Experimental |
| Module: | mod_md |
The configured executable is run when Managed Domains have signed up or - renewed their certificates. It is given the names of the processed MDs as - additional arguments (after the parameters specified here). It should - return status code 0 to indicate that it has run successfully. +
+ The configured executable is run when a Managed Domain has signed up or + renewed its certificate. It is given the name of the processed MD as + additional arguments (after the parameters specified here). It should + return status code 0 to indicate that it has run successfully.
All the names in the list are managed as one Managed Domain (MD).
- mod_md will request one single certificate that is valid for all these names. This
+ mod_md will request one single certificate that is valid for all these names. This
directive uses the global settings (see other MD directives below). If you
need specific settings for one MD, use
the <MDomainSet>.
@@ -366,12 +632,11 @@ MDCertificateAgreement https://letsencrypt.org/documents/LE-SA-v1.2-November-15-
changes in its service or status of your certificates.
The second setting, MDCertificateAgreement,
- is the URL of the Terms of Service of the CA. When you configure the URL,
- you confirm that you have read and agree to the terms described in the linked
- document. Before you do that, the CA will not hand out certificates to you.
+ should have the value "accepted". By specifying this, you confirm that your
+ accept the Terms of Service of the CA.
ServerAdmin mailto:admin@example.org
-MDCertificateAgreement https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
+MDCertificateAgreement accepted
MDomain example.org www.example.org
<VirtualHost *:443>
@@ -392,7 +657,7 @@ MDomain example.org www.example.org
There are two special names that you may use in this directive: 'manual'
and 'auto'. This determines if a Managed Domain shall have exactly the
name list as is configured ('manual') or offer more convenience. With 'auto'
- all names of a virtual host are added to a MD. Conventiently, 'auto' is also
+ all names of a virtual host are added to a MD. Conveniently, 'auto' is also
the default.
Example
MDomain example.org
@@ -434,20 +699,26 @@ MDomain example2.org auto
Module: mod_md
- This directive allows you to define a Managed Domain (MD) with specific
- settings, different from the global MD* ones. For example, you can have
- such an MD use another CA then Let's Encrypt, have its unique renewal duration
- etc.
+ This is the directive MDomain
+ with the added possibility to add setting just for this MD. In fact,
+ you may also use "<MDomain ..>" as a shortcut.
- Example
<MDomainSet sandbox.example.org>
+
+ This allows you to configure an MD that uses another Certificate Authority,
+ have other renewal requirements, etc.
+
+ Example
<MDomain sandbox.example.org>
MDCertificateAuthority https://someotherca.com/ACME
- MDCertificateAgreement https://someotherca.com/terms/v_1.02.pdf
-</MDomainSet>
+</MDomain>
+
+
+ A common use case is to configure https: requirements separately for
+ your domains.
+
+ Example
<MDomain example.org>
+ MDRequireHttps temporary
+</MDomain>
- This is a specialized version of MDomain,
- it should be used only when a fine grained configuration is required.
- MDomain is the suggested choice
- for the general use case.
@@ -455,33 +726,41 @@ MDomain example2.org auto
Description: Map external to internal ports for domain ownership verification.
Syntax: MDPortMap map1 [ map2 ]
-Default: MDPortMap 80:80 443:443
+Default: MDPortMap http:80 https:443
Context: server config
Status: Experimental
Module: mod_md
- The ACME protocol provides two methods to verify domain ownership: one that uses
- port 80 and one for port 443. If your server is not reachable by at least one
- of the two, ACME will not work for you.
+ The ACME protocol provides two methods to verify domain ownership via
+ HTTP: one that uses 'http:' urls (port 80) and one for 'https:' urls
+ (port 443). If your server is not reachable by at least one
+ of the two, ACME may only work by configuring your DNS server,
+ see MDChallengeDns01.
- mod_md will look at your server configuration and try to figure
- out which of those are available. Then it can select the proper ACME challenge
- to create a certificate for your site.
+ On most public facing servers, 'http:' arrives on port 80 and
+ 'https:' on port 443. The module checks the ports your Apache server
+ is listening on and assumes those are available. This means that
+ when your server does not listen on port 80, it assumes that
+ 'http:' requests from the internet will not work.
- However if you have some fancy port forwarding in place, your server may be
- reachable from the Internet on port 443, but the local port that httpd uses is
- another one. Your server might only listen on ports 5001 and 5002, but be reached
- on ports 443 and 80. How should mod_md figure that one out?
-
- With MDPortMap you can tell it which 'Internet port'
- corresponds to which local port.
+ This is a good guess, but it may be wrong. For example, your Apache
+ might listen to port 80, but your firewall might block it. 'http:'
+ is only available in your intranet. So, the module will falsely assume
+ that Let's Encrypt can use 'http:' challenges with your server. This
+ will then fail, because your firewall will drop those.
- Example
MDPortMap 80:- 443:5002
+ Example
MDPortMap http:- https:8433
- This example says that the server is not reachable on port 80 from the outside, but
- local port 5002 is the one responding to https: requests.
+ The above example shows how you can specify that 'http:' requests from
+ the internet will never arrive. In addition it says that 'https:' requests
+ will arrive on local port 8433.
+
+ This is necessary if you have port forwarding in place, your server may be
+ reachable from the Internet on port 443, but the local port that httpd uses is
+ another one. Your server might only listen on ports 8443 and 8000, but be reached
+ on ports 443 and 80 (from the internet).
@@ -515,6 +794,38 @@ MDomain example2.org auto
generated for certificates. ACME account keys are unaffected by this.
+
+
+MDRenewMode Directive ¶
+
+Description: Controls if certificates shall be renewed.
+Syntax: MDRenewMode always|auto|manual
+Default: MDRenewMode auto
+Context: server config
+Status: Experimental
+Module: mod_md
+
+
+ In the default 'auto' mode, the module will do what makes most sense
+ of each Managed Domain. For a domain without any certificates, it will
+ obtain them from the Certificate Authority.
+
+
+ However, if you have defined an MD that is not used by any of Apache's
+ VirtualHosts, it will not bother. And for MDs with static certificate
+ files (see MDCertificateFile),
+ it assumes that you have your own source, and will not renew them either.
+
+
+ You can override this default in either way. If you specify 'always',
+ the module will renew certificates for an MD, irregardless if the
+ domains are in use or if there are static files.
+
+
+ For the opposite effect, configure 'manual' and no renewal will
+ be attempted.
+
+
MDRenewWindow Directive ¶
@@ -527,10 +838,10 @@ MDomain example2.org auto
Module: mod_md
- If the validity of the certificate falls below duration, mod_md
+ If the validity of the certificate falls below duration, mod_md
will get a new signed certificate.
- Normally, certificates are valid for around 90 days and mod_md will renew
+ Normally, certificates are valid for around 90 days and mod_md will renew
them the earliest 33% of their complete lifetime before they expire (so for
90 days validity, 30 days before it expires). If you think this is not what
you need, you can specify either the exact time, as in:
@@ -594,17 +905,36 @@ MDRenewWindow 10%
You can achieve the same with mod_alias and some
Redirect configuration,
basically. If you do it yourself, please make sure to exclude the paths
- /.well-known/* from your redirection, otherwise mod_md
+ /.well-known/* from your redirection, otherwise mod_md
might have trouble signing on new certificates.
If you set this globally, it applies to all managed domains. If you want
it for a specific domain only, use:
- Example
<MDomainSet xxx.yyy>
+ Example
<MDomain xxx.yyy>
MDRequireHttps temporary
-</MDomainSet>
+</MDomain>
+
+
+MDServerStatus Directive ¶
+
+Description: Control if Managed Domain information is added to server-status.
+Syntax: MDServerStatus on|off
+Default: MDServerStatus on
+Context: server config
+Status: Experimental
+Module: mod_md
+
+
+ Apaches 'server-status' handler allows you configure a resource to monitor
+ what is going on. This includes now a section listing all Managed Domains
+ with the DNS names, renewal status, lifetimes and main properties.
+
+ You can switch that off using this directive.
+
+
MDStoreDir Directive ¶
@@ -627,6 +957,30 @@ MDRenewWindow 10%
are missing.
+
+
+MDWarnWindow Directive ¶
+
+Description: Define the time window when you want to be warned about an expiring certificate.
+Syntax: MDWarnWindow duration
+Default: MDWarnWindow 10%
+Context: server config
+Status: Experimental
+Module: mod_md
+
+
+ See MDRenewWindow for a description on
+ how you can specify the time.
+
+ The modules checks the remaining lifetime of certificates and invokes
+ MDMessageCmd when there is less than the warn
+ window left. With the default, this mean 9 days for certificates from
+ Let's Encrypt.
+
+ It also applies to Managed Domains with static certificate files (
+ see MDCertificateFile).
+
+
diff --git a/docs/manual/mod/mod_mime.html.en b/docs/manual/mod/mod_mime.html.en
index 1c6dc26cb88..af8174d1c01 100644
--- a/docs/manual/mod/mod_mime.html.en
+++ b/docs/manual/mod/mod_mime.html.en
@@ -666,7 +666,7 @@ assigned a language-tag by some other means.
MimeOptions Directive ¶