pma_vhost.j2 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. {% if phpmyadmin_ssl and ssl_certs_auto_installed.stdout_lines is defined and phpmyadmin_vhostname in ssl_certs_auto_installed.stdout_lines %}
  9. RedirectMatch permanent (.*) https://{{ phpmyadmin_vhostname }}$1
  10. {% else %}
  11. DocumentRoot /usr/share/phpmyadmin
  12. DirectoryIndex index.php
  13. {% if http_auth_phpmyadmin %}
  14. <Location />
  15. AuthType basic
  16. AuthName "Restricted Access"
  17. AuthUserFile /etc/apache2/auth_admin
  18. Require valid-user
  19. </Location>
  20. {% endif %}
  21. Include /etc/phpmyadmin/apache.conf
  22. <IfModule mod_php5.c>
  23. php_admin_value max_execution_time 240
  24. php_admin_value upload_max_filesize 128M
  25. php_admin_value post_max_size 128M
  26. </IfModule>
  27. LogLevel warn
  28. CustomLog ${APACHE_LOG_DIR}/pma.access.log combined
  29. ErrorLog ${APACHE_LOG_DIR}/pma.error.log
  30. {% endif %}
  31. </VirtualHost>
  32. {% if phpmyadmin_ssl and ssl_certs_auto_installed.stdout_lines is defined and phpmyadmin_vhostname in ssl_certs_auto_installed.stdout_lines %}
  33. <VirtualHost {%if phpmyadmin_vhostip %}{{ phpmyadmin_vhostip }}{% else %}*{% endif %}:{%if phpmyadmin_vhostport %}{{ phpmyadmin_vhostport }}{% else %}443{% endif %}>
  34. ServerName {{ phpmyadmin_vhostname }}
  35. Include vhost_ssl_auto-{{ phpmyadmin_vhostname }}.conf
  36. DocumentRoot /usr/share/phpmyadmin
  37. DirectoryIndex index.php
  38. {% if http_auth_phpmyadmin %}
  39. <Location />
  40. AuthType basic
  41. AuthName "Restricted Access"
  42. AuthUserFile /etc/apache2/auth_admin
  43. Require valid-user
  44. </Location>
  45. {% endif %}
  46. Include /etc/phpmyadmin/apache.conf
  47. <IfModule mod_php5.c>
  48. php_admin_value max_execution_time 240
  49. php_admin_value upload_max_filesize 128M
  50. php_admin_value post_max_size 128M
  51. </IfModule>
  52. LogLevel warn
  53. CustomLog ${APACHE_LOG_DIR}/pma.access.log combined
  54. ErrorLog ${APACHE_LOG_DIR}/pma.error.log
  55. </VirtualHost>
  56. {% endif %}