mirror of
https://github.com/geerlingguy/ansible-role-apache
synced 2025-01-03 00:30:18 +01:00
added option to disable the defaults directory directive for document roots
This commit is contained in:
parent
88d910923c
commit
4e50ed0fab
3 changed files with 10 additions and 2 deletions
|
@ -46,6 +46,10 @@ You can add or override global Apache configuration settings in the role-provide
|
|||
|
||||
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).
|
||||
|
||||
apache_documentroot_directory_defaults: true
|
||||
|
||||
As the vhost file template automatically sets a default <Directory> directive for your document root, you can disable this by settings this value to `false` and add your own <Directory> directive for your document root via `extra_parameters`.
|
||||
|
||||
Here's an example using `extra_parameters` to add a RewriteRule to redirect all requests to the `www.` site:
|
||||
|
||||
- servername: "www.local.dev"
|
||||
|
|
|
@ -15,6 +15,10 @@ apache_remove_default_vhost: false
|
|||
apache_global_vhost_settings: |
|
||||
DirectoryIndex index.php index.html
|
||||
|
||||
# Create default <Directory "{{apache_vhosts.documentroot}}">-Directive
|
||||
# Set this to `false` for your own <Directory>-Directive in apache_vhosts.extra_parameters
|
||||
apache_documentroot_directory_defaults: true
|
||||
|
||||
apache_vhosts:
|
||||
# Additional properties: 'serveradmin, serveralias, extra_parameters'.
|
||||
- servername: "local.dev"
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
{% if vhost.serveradmin is defined %}
|
||||
ServerAdmin {{ vhost.serveradmin }}
|
||||
{% endif %}
|
||||
{% if vhost.documentroot is defined %}
|
||||
{% if vhost.documentroot is defined and apache_documentroot_directory_defaults %}
|
||||
<Directory "{{ vhost.documentroot }}">
|
||||
AllowOverride All
|
||||
Options -Indexes +FollowSymLinks
|
||||
|
@ -61,7 +61,7 @@
|
|||
{% if vhost.serveradmin is defined %}
|
||||
ServerAdmin {{ vhost.serveradmin }}
|
||||
{% endif %}
|
||||
{% if vhost.documentroot is defined %}
|
||||
{% if vhost.documentroot is defined and apache_documentroot_directory_defaults %}
|
||||
<Directory "{{ vhost.documentroot }}">
|
||||
AllowOverride All
|
||||
Options -Indexes +FollowSymLinks
|
||||
|
|
Loading…
Reference in a new issue