Fixes #27 and #42: Add example of multiline configuration in apache_vhosts entries.

This commit is contained in:
Jeff Geerling 2015-09-03 16:16:04 -05:00
parent 35e662cd00
commit 8a4f5f3ff2
2 changed files with 16 additions and 5 deletions

View file

@ -32,10 +32,22 @@ On Debian/Ubuntu, a default virtualhost is included in Apache's configuration. S
apache_vhosts:
# Additional optional properties: 'serveradmin, serveralias, extra_parameters'.
- {servername: "local.dev", documentroot: "/var/www/html"}
- servername: "local.dev"
documentroot: "/var/www/html"
Add a set of properties per virtualhost, including `servername` (required), `documentroot` (required), `serveradmin` (optional), `serveralias` (optional) and `extra_parameters` (optional: you can add whatever additional configuration lines you'd like in here).
Here's an example using `extra_parameters` to add a RewriteRule to redirect all requests to the `www.` site:
- servername: "www.local.dev"
serveralias: "local.dev"
documentroot: "/var/www/html"
extra_parameters: |
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
The `|` denotes a multiline scalar block in YAML, so newlines are preserved in the resulting configuration file output.
apache_vhosts_ssl: []
No SSL vhosts are configured by default, but you can add them using the same pattern as `apache_vhosts`, with a few additional directives, like the following example:

View file

@ -13,18 +13,17 @@ apache_remove_default_vhost: false
apache_vhosts:
# Additional properties: 'serveradmin, serveralias, extra_parameters'.
- {servername: "local.dev", documentroot: "/var/www/html"}
- servername: "local.dev"
documentroot: "/var/www/html"
apache_vhosts_ssl: []
# Additional properties: 'serveradmin, extra_parameters'.
# - {
# servername: "local.dev",
# - servername: "local.dev",
# documentroot: "/var/www/html",
# certificate_file: "/path/to/certificate.crt",
# certificate_key_file: "/path/to/certificate.key",
# # Optional.
# certificate_chain_file: "/path/to/certificate_chain.crt"
# }
apache_ssl_protocol: "All -SSLv2 -SSLv3"
apache_ssl_cipher_suite: "AES256+EECDH:AES256+EDH"