pma_vhost.j2 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. {% if ansible_prolog -%}
  2. {% from 'templates/ansible/prolog.j2' import prolog with context %}
  3. {{ prolog() }}
  4. {% endif -%}
  5. # Apache vhost for phpmyadmin
  6. <VirtualHost {%if phpmyadmin_vhostip %}{{ phpmyadmin_vhostip }}{% else %}*{% endif %}:{%if phpmyadmin_vhostport %}{{ phpmyadmin_vhostport }}{% else %}80{% endif %}>
  7. ServerName {{ phpmyadmin_vhostname }}
  8. Include conf-available/letsencrypt.conf
  9. {% if phpmyadmin_ssl and ssl_certs_auto_installed.stdout_lines is defined and phpmyadmin_vhostname in ssl_certs_auto_installed.stdout_lines %}
  10. RedirectMatch 301 ^(?!/\.well-known/acme-challenge/).* https://{{ phpmyadmin_vhostname }}$0
  11. {% else %}
  12. DocumentRoot /usr/share/phpmyadmin
  13. DirectoryIndex index.php
  14. {% if http_auth_phpmyadmin %}
  15. <Location />
  16. AuthType basic
  17. AuthName "Restricted Access"
  18. AuthUserFile /etc/apache2/auth_admin
  19. Require valid-user
  20. </Location>
  21. {% endif %}
  22. Include /etc/phpmyadmin/apache.conf
  23. <Directory /usr/share/phpmyadmin>
  24. <IfModule mod_php5.c>
  25. php_admin_value max_execution_time 240
  26. php_admin_value upload_max_filesize 128M
  27. php_admin_value post_max_size 128M
  28. </IfModule>
  29. <IfModule php7_module>
  30. php_admin_value max_execution_time 240
  31. php_admin_value upload_max_filesize 128M
  32. php_admin_value post_max_size 128M
  33. </IfModule>
  34. </Directory>
  35. {% if with_fpm|bool %}
  36. Include conf-available/fpm-pool.conf
  37. {% endif %}
  38. LogLevel warn
  39. CustomLog ${APACHE_LOG_DIR}/pma.access.log combined
  40. ErrorLog ${APACHE_LOG_DIR}/pma.error.log
  41. {% endif %}
  42. </VirtualHost>
  43. {% if phpmyadmin_ssl and ssl_certs_auto_installed.stdout_lines is defined and phpmyadmin_vhostname in ssl_certs_auto_installed.stdout_lines %}
  44. <VirtualHost {%if phpmyadmin_vhostip %}{{ phpmyadmin_vhostip }}{% else %}*{% endif %}:{%if phpmyadmin_vhostport %}{{ phpmyadmin_vhostport }}{% else %}443{% endif %}>
  45. ServerName {{ phpmyadmin_vhostname }}
  46. <IfModule http2_module>
  47. Protocols h2 http/1.1
  48. </IfModule>
  49. Include vhost_ssl_auto-{{ phpmyadmin_vhostname }}.conf
  50. DocumentRoot /usr/share/phpmyadmin
  51. DirectoryIndex index.php
  52. {% if http_auth_phpmyadmin %}
  53. <Location />
  54. AuthType basic
  55. AuthName "Restricted Access"
  56. AuthUserFile /etc/apache2/auth_admin
  57. Require valid-user
  58. </Location>
  59. {% endif %}
  60. Include /etc/phpmyadmin/apache.conf
  61. <Directory /usr/share/phpmyadmin>
  62. <IfModule mod_php5.c>
  63. php_admin_value max_execution_time 240
  64. php_admin_value upload_max_filesize 128M
  65. php_admin_value post_max_size 128M
  66. </IfModule>
  67. <IfModule php7_module>
  68. php_admin_value max_execution_time 240
  69. php_admin_value upload_max_filesize 128M
  70. php_admin_value post_max_size 128M
  71. </IfModule>
  72. </Directory>
  73. {% if with_fpm|bool %}
  74. Include conf-available/fpm-pool.conf
  75. {% endif %}
  76. LogLevel warn
  77. CustomLog ${APACHE_LOG_DIR}/pma.access.log combined
  78. ErrorLog ${APACHE_LOG_DIR}/pma.error.log
  79. </VirtualHost>
  80. {% endif %}