pma_vhost.j2 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. <IfModule mod_php5.c>
  24. php_admin_value max_execution_time 240
  25. php_admin_value upload_max_filesize 128M
  26. php_admin_value post_max_size 128M
  27. </IfModule>
  28. {% if with_fpm|bool %}
  29. Include conf-available/fpm-pool.conf
  30. {% endif %}
  31. LogLevel warn
  32. CustomLog ${APACHE_LOG_DIR}/pma.access.log combined
  33. ErrorLog ${APACHE_LOG_DIR}/pma.error.log
  34. {% endif %}
  35. </VirtualHost>
  36. {% if phpmyadmin_ssl and ssl_certs_auto_installed.stdout_lines is defined and phpmyadmin_vhostname in ssl_certs_auto_installed.stdout_lines %}
  37. <VirtualHost {%if phpmyadmin_vhostip %}{{ phpmyadmin_vhostip }}{% else %}*{% endif %}:{%if phpmyadmin_vhostport %}{{ phpmyadmin_vhostport }}{% else %}443{% endif %}>
  38. ServerName {{ phpmyadmin_vhostname }}
  39. <IfModule http2_module>
  40. Protocols h2 http/1.1
  41. </IfModule>
  42. Include vhost_ssl_auto-{{ phpmyadmin_vhostname }}.conf
  43. DocumentRoot /usr/share/phpmyadmin
  44. DirectoryIndex index.php
  45. {% if http_auth_phpmyadmin %}
  46. <Location />
  47. AuthType basic
  48. AuthName "Restricted Access"
  49. AuthUserFile /etc/apache2/auth_admin
  50. Require valid-user
  51. </Location>
  52. {% endif %}
  53. Include /etc/phpmyadmin/apache.conf
  54. <IfModule mod_php5.c>
  55. php_admin_value max_execution_time 240
  56. php_admin_value upload_max_filesize 128M
  57. php_admin_value post_max_size 128M
  58. </IfModule>
  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}/pma.access.log combined
  69. ErrorLog ${APACHE_LOG_DIR}/pma.error.log
  70. </VirtualHost>
  71. {% endif %}