sys_vhost.j2 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. {% if http_auth_syscheck %}
  15. <Location />
  16. AuthType basic
  17. AuthName "Restricted Access"
  18. AuthUserFile /etc/apache2/auth_admin
  19. Require valid-user
  20. </Location>
  21. {% endif %}
  22. <Directory /etc/phpsyscheck>
  23. Options None
  24. AllowOverride None
  25. Order allow,deny
  26. Allow from all
  27. </Directory>
  28. {% if with_fpm|bool %}
  29. Include conf-available/fpm-pool.conf
  30. {% endif %}
  31. LogLevel warn
  32. CustomLog ${APACHE_LOG_DIR}/sys.access.log combined
  33. ErrorLog ${APACHE_LOG_DIR}/sys.error.log
  34. {% endif %}
  35. </VirtualHost>
  36. {% if phpsyscheck_ssl and ssl_certs_auto_installed.stdout_lines is defined and phpsyscheck_vhostname in ssl_certs_auto_installed.stdout_lines %}
  37. <VirtualHost {%if phpsyscheck_vhostip %}{{ phpsyscheck_vhostip }}{% else %}*{% endif %}:{%if phpsyscheck_vhostport %}{{ phpsyscheck_vhostport }}{% else %}443{% endif %}>
  38. ServerName {{ phpsyscheck_vhostname }}
  39. <IfModule http2_module>
  40. Protocols h2 http/1.1
  41. </IfModule>
  42. Include vhost_ssl_auto-{{ phpsyscheck_vhostname }}.conf
  43. DocumentRoot /etc/phpsyscheck
  44. DirectoryIndex index.php
  45. {% if http_auth_syscheck %}
  46. <Location />
  47. AuthType basic
  48. AuthName "Restricted Access"
  49. AuthUserFile /etc/apache2/auth_admin
  50. Require valid-user
  51. </Location>
  52. {% endif %}
  53. <Directory /etc/phpsyscheck>
  54. Options None
  55. AllowOverride None
  56. Order allow,deny
  57. Allow from all
  58. </Directory>
  59. <IfModule php7_module>
  60. php_admin_value max_execution_time 240
  61. php_admin_value upload_max_filesize 128M
  62. php_admin_value post_max_size 128M
  63. </IfModule>
  64. {% if with_fpm|bool %}
  65. Include conf-available/fpm-pool.conf
  66. {% endif %}
  67. LogLevel warn
  68. CustomLog ${APACHE_LOG_DIR}/sys.access.log combined
  69. ErrorLog ${APACHE_LOG_DIR}/sys.error.log
  70. </VirtualHost>
  71. {% endif %}