pma_vhost.j2 3.6 KB

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