Browse Source

Add well-known directory to all hosts served by Apache

Thomas Buck 5 years ago
parent
commit
cce03e9f94

+ 18
- 2
roles/blog/tasks/blog.yml View File

2
   file: state=directory path={{ item }} group=www-data owner={{ main_user_name }}
2
   file: state=directory path={{ item }} group=www-data owner={{ main_user_name }}
3
   with_items: "{{ virtual_domains | json_query('[*].doc_root') | unique }}"
3
   with_items: "{{ virtual_domains | json_query('[*].doc_root') | unique }}"
4
 
4
 
5
-- name: Create the Apache sites config files
5
+- name: Create directory for well-known configs
6
+  file: state=directory path=/var/www/well-known group=www-data owner=www-data
7
+
8
+- name: Create the Apache well-known config
9
+  template:
10
+    src=etc_apache2_conf-available_well-known.j2
11
+    dest=/etc/apache2/conf-available/well-known.conf
12
+    owner=root
13
+    group=root
14
+  notify: restart apache
15
+
16
+- name: Enable the Apache well-known config
17
+  command: a2enconf well-known.conf creates=/etc/apache2/conf-enabled/well-known.conf.conf
18
+  notify: restart apache
19
+
20
+- name: Create the Apache blog sites config files
6
   template:
21
   template:
7
     src=etc_apache2_sites-available_blog.j2
22
     src=etc_apache2_sites-available_blog.j2
8
     dest=/etc/apache2/sites-available/{{ item.name }}.conf
23
     dest=/etc/apache2/sites-available/{{ item.name }}.conf
9
     owner=root
24
     owner=root
10
     group=root
25
     group=root
26
+  notify: restart apache
11
   with_items: "{{ virtual_domains }}"
27
   with_items: "{{ virtual_domains }}"
12
 
28
 
13
-- name: Enable Apache sites (creates new sites-enabled symlinks)
29
+- name: Enable Apache blog sites (creates new sites-enabled symlinks)
14
   command: a2ensite {{ item }}.conf creates=/etc/apache2/sites-enabled/{{ item }}.conf
30
   command: a2ensite {{ item }}.conf creates=/etc/apache2/sites-enabled/{{ item }}.conf
15
   notify: restart apache
31
   notify: restart apache
16
   with_items: "{{ virtual_domains | json_query('[*].name') }}"
32
   with_items: "{{ virtual_domains | json_query('[*].name') }}"

+ 7
- 0
roles/blog/templates/etc_apache2_conf-available_well-known.j2 View File

1
+Alias /.well-known /var/www/well-known
2
+
3
+<Directory /var/www/well-known>
4
+    Options +Indexes +FollowSymLinks
5
+    AllowOverride none
6
+    Require all granted
7
+</Directory>

Loading…
Cancel
Save