Преглед изворни кода

Fix minors issues with Let's Encrypt and Apache

Emmanuel Bouthenot пре 6 година
родитељ
комит
0e6a6bd7c3

+ 0 - 9
roles/webserver/tasks/apache2.yml

@@ -68,15 +68,6 @@
     - 'Reload apache2'
   when: ssl_certs_auto
 
-- name: 'Install Lets Encrypt configuration for Apache2 (conf-enabled)'
-  file:
-    src: '/etc/apache2/conf-available/letsencrypt.conf'
-    path: '/etc/apache2/conf-enabled/letsencrypt.conf'
-    state: 'link'
-  notify:
-    - 'Reload apache2'
-  when: ssl_certs_auto
-
 - name: 'Create basic authentication file for admin (Apache2)'
   template:
     src: 'apache2/auth_admin.j2'

+ 3 - 1
roles/webserver/templates/apache2/pma_vhost.j2

@@ -7,8 +7,10 @@
 <VirtualHost {%if phpmyadmin_vhostip %}{{ phpmyadmin_vhostip }}{% else %}*{% endif %}:{%if phpmyadmin_vhostport %}{{ phpmyadmin_vhostport }}{% else %}80{% endif %}>
     ServerName {{ phpmyadmin_vhostname }}
 
+    Include conf-available/letsencrypt.conf
+
 {% if phpmyadmin_ssl and ssl_certs_auto_installed.stdout_lines is defined and phpmyadmin_vhostname in ssl_certs_auto_installed.stdout_lines %}
-    RedirectMatch permanent (.*) https://{{ phpmyadmin_vhostname }}$1
+    RedirectMatch 301 ^(?!/\.well-known/acme-challenge/).* https://{{ phpmyadmin_vhostname }}$0
 {% else %}
     DocumentRoot /usr/share/phpmyadmin
     DirectoryIndex index.php

+ 3 - 1
roles/webserver/templates/apache2/sys_vhost.j2

@@ -7,8 +7,10 @@
 <VirtualHost {%if phpsyscheck_vhostip %}{{ phpsyscheck_vhostip }}{% else %}*{% endif %}:{%if phpsyscheck_vhostport %}{{ phpsyscheck_vhostport }}{% else %}80{% endif %}>
     ServerName {{ phpsyscheck_vhostname }}
 
+    Include conf-available/letsencrypt.conf
+
 {% if phpsyscheck_ssl and ssl_certs_auto_installed.stdout_lines is defined and phpsyscheck_vhostname in ssl_certs_auto_installed.stdout_lines %}
-    RedirectMatch permanent (.*) https://{{ phpsyscheck_vhostname }}$1
+    RedirectMatch 301 ^(?!/\.well-known/acme-challenge/).* https://{{ phpsyscheck_vhostname }}$0
 {% else %}
     DocumentRoot /etc/phpsyscheck
     DirectoryIndex index.php