pma_vhost.j2 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 phpmyadmin_http_auth %}
  15. <Location />
  16. AuthType basic
  17. AuthName "Restricted Access"
  18. AuthUserFile /etc/apache2/auth_admin
  19. <RequireAny>
  20. {% if phpmyadmin_http_whitelist_ip|length > 0 %}
  21. Require ip {{ phpmyadmin_http_whitelist_ip | join(' ') }}
  22. {% endif %}
  23. Require valid-user
  24. </RequireAny>
  25. </Location>
  26. {% endif %}
  27. Include /etc/phpmyadmin/apache.conf
  28. <Directory /usr/share/phpmyadmin>
  29. <IfModule mod_php5.c>
  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. php_admin_value max_input_vars 10000
  34. </IfModule>
  35. <IfModule php7_module>
  36. php_admin_value max_execution_time 240
  37. php_admin_value upload_max_filesize 128M
  38. php_admin_value post_max_size 128M
  39. php_admin_value max_input_vars 10000
  40. </IfModule>
  41. </Directory>
  42. {% if with_fpm|bool %}
  43. Include conf-available/fpm-pool.conf
  44. {% endif %}
  45. LogLevel warn
  46. CustomLog ${APACHE_LOG_DIR}/pma.access.log combined
  47. ErrorLog ${APACHE_LOG_DIR}/pma.error.log
  48. {% endif %}
  49. </VirtualHost>
  50. {% if phpmyadmin_ssl and ssl_certs_auto_installed.stdout_lines is defined and phpmyadmin_vhostname in ssl_certs_auto_installed.stdout_lines %}
  51. <VirtualHost {%if phpmyadmin_vhostip %}{{ phpmyadmin_vhostip }}{% else %}*{% endif %}:{%if phpmyadmin_vhostport %}{{ phpmyadmin_vhostport }}{% else %}443{% endif %}>
  52. ServerName {{ phpmyadmin_vhostname }}
  53. <IfModule http2_module>
  54. Protocols h2 http/1.1
  55. </IfModule>
  56. Include vhost_ssl_auto-{{ phpmyadmin_vhostname }}.conf
  57. DocumentRoot /usr/share/phpmyadmin
  58. DirectoryIndex index.php
  59. {% if phpmyadmin_http_auth %}
  60. <Location />
  61. AuthType basic
  62. AuthName "Restricted Access"
  63. AuthUserFile /etc/apache2/auth_admin
  64. <RequireAny>
  65. {% if phpmyadmin_http_whitelist_ip|length > 0 %}
  66. Require ip {{ phpmyadmin_http_whitelist_ip | join(' ') }}
  67. {% endif %}
  68. Require valid-user
  69. </RequireAny>
  70. </Location>
  71. {% endif %}
  72. Include /etc/phpmyadmin/apache.conf
  73. <Directory /usr/share/phpmyadmin>
  74. <IfModule mod_php5.c>
  75. php_admin_value max_execution_time 240
  76. php_admin_value upload_max_filesize 128M
  77. php_admin_value post_max_size 128M
  78. php_admin_value max_input_vars 10000
  79. </IfModule>
  80. <IfModule php7_module>
  81. php_admin_value max_execution_time 240
  82. php_admin_value upload_max_filesize 128M
  83. php_admin_value post_max_size 128M
  84. php_admin_value max_input_vars 10000
  85. </IfModule>
  86. </Directory>
  87. {% if with_fpm|bool %}
  88. Include conf-available/fpm-pool.conf
  89. {% endif %}
  90. LogLevel warn
  91. CustomLog ${APACHE_LOG_DIR}/pma.access.log combined
  92. ErrorLog ${APACHE_LOG_DIR}/pma.error.log
  93. </VirtualHost>
  94. {% endif %}