sys_vhost.j2 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. {% if ansible_prolog -%}
  2. {% from 'templates/ansible/prolog.j2' import prolog with context %}
  3. {{ prolog() }}
  4. {% endif -%}
  5. # Apache vhost for PHP system checks
  6. <VirtualHost {%if phpsyscheck_vhostip %}{{ phpsyscheck_vhostip }}{% else %}*{% endif %}:{%if phpsyscheck_vhostport %}{{ phpsyscheck_vhostport }}{% else %}80{% endif %}>
  7. ServerName {{ phpsyscheck_vhostname }}
  8. Include conf-available/letsencrypt.conf
  9. {% if phpsyscheck_ssl and ssl_certs_auto_installed.stdout_lines is defined and phpsyscheck_vhostname in ssl_certs_auto_installed.stdout_lines %}
  10. RedirectMatch 301 ^(?!/\.well-known/acme-challenge/).* https://{{ phpsyscheck_vhostname }}$0
  11. {% else %}
  12. DocumentRoot /etc/phpsyscheck
  13. DirectoryIndex index.php
  14. <Location />
  15. AuthType basic
  16. AuthName "Restricted Access"
  17. AuthUserFile /etc/apache2/auth_admin
  18. Require valid-user
  19. </Location>
  20. <Directory /etc/phpsyscheck>
  21. Options None
  22. AllowOverride None
  23. Order allow,deny
  24. Allow from all
  25. </Directory>
  26. LogLevel warn
  27. CustomLog ${APACHE_LOG_DIR}/sys.access.log combined
  28. ErrorLog ${APACHE_LOG_DIR}/sys.error.log
  29. {% endif %}
  30. </VirtualHost>
  31. {% if phpsyscheck_ssl and ssl_certs_auto_installed.stdout_lines is defined and phpsyscheck_vhostname in ssl_certs_auto_installed.stdout_lines %}
  32. <VirtualHost {%if phpsyscheck_vhostip %}{{ phpsyscheck_vhostip }}{% else %}*{% endif %}:{%if phpsyscheck_vhostport %}{{ phpsyscheck_vhostport }}{% else %}443{% endif %}>
  33. ServerName {{ phpsyscheck_vhostname }}
  34. Include vhost_ssl_auto-{{ phpsyscheck_vhostname }}.conf
  35. DocumentRoot /etc/phpsyscheck
  36. DirectoryIndex index.php
  37. {% if http_auth_phpmyadmin %}
  38. <Location />
  39. AuthType basic
  40. AuthName "Restricted Access"
  41. AuthUserFile /etc/apache2/auth_admin
  42. Require valid-user
  43. </Location>
  44. {% endif %}
  45. <Directory /etc/phpsyscheck>
  46. Options None
  47. AllowOverride None
  48. Order allow,deny
  49. Allow from all
  50. </Directory>
  51. LogLevel warn
  52. CustomLog ${APACHE_LOG_DIR}/sys.access.log combined
  53. ErrorLog ${APACHE_LOG_DIR}/sys.error.log
  54. </VirtualHost>
  55. {% endif %}