sys_vhost.j2 2.5 KB

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