Skip to content

Commit

Permalink
feat: allow overriding document_root weareinteractive#15
Browse files Browse the repository at this point in the history
  • Loading branch information
adam committed Mar 10, 2023
1 parent 19836bc commit 6dbbb6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# apache2_sites:
# - id: mysite (required)
# name: mysite.local (required)
# document_root: ""
# ip: '*'
# port: 80
# state: present
Expand Down
8 changes: 8 additions & 0 deletions templates/etc/apache2/sites-available/site/body.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
ServerName {{ item.name }}
{% if item.document_root is defined %}
DocumentRoot {{ item.document_root }}
{% else %}
DocumentRoot {{ apache2_sites_basedir }}/{{ item.id }}/htdocs
{% endif %}
{% for value in item.aliases|default([]) %}
ServerAlias {{ value }}
{% endfor %}
Expand All @@ -12,7 +16,11 @@

# --- directories -----------------------------------------------------------

{% if item.document_root is defined %}
<Directory {{ item.document_root }}>
{% else %}
<Directory {{ apache2_sites_basedir }}/{{ item.id }}/htdocs>
{% endif %}
AllowOverride All
Options FollowSymLinks
Require all granted
Expand Down

0 comments on commit 6dbbb6d

Please sign in to comment.