pma_vhost.j2 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. {% if ansible_prolog -%}
  2. {% from 'templates/ansible/prolog.j2' import prolog with context %}
  3. {{ prolog() }}
  4. {% endif -%}
  5. # Nginx vhost for phpmyadmin
  6. server {
  7. {% if phpmyadmin_vhostip or phpmyadmin_vhostport %}
  8. listen {% if phpmyadmin_vhostip %}{{ phpmyadmin_vhostip }}{% endif %}{% if phpmyadmin_vhostip and phpmyadmin_vhostport %}:{% endif %}{% if phpmyadmin_vhostport %}{{ phpmyadmin_vhostport }}{% endif %};
  9. {% endif %}
  10. server_name {{ phpmyadmin_vhostname }};
  11. access_log /var/log/nginx/pma.access.log main;
  12. error_log /var/log/nginx/pma.error.log;
  13. {% if phpmyadmin_ssl %}
  14. include letsencrypt;
  15. {% endif %}
  16. {% if phpmyadmin_ssl and ssl_certs_auto_installed.stdout_lines is defined and phpmyadmin_vhostname in ssl_certs_auto_installed.stdout_lines %}
  17. location / {
  18. return 301 https://{{ phpmyadmin_vhostname }}$request_uri;
  19. }
  20. {% else %}
  21. root /usr/share/phpmyadmin;
  22. index index.php;
  23. try_files $uri $uri/ /index.php;
  24. {% if http_auth_phpmyadmin %}
  25. auth_basic "Restricted Access";
  26. auth_basic_user_file /etc/nginx/auth_admin;
  27. {% endif %}
  28. client_max_body_size 128m;
  29. location ~ \.php(/|$) {
  30. include fastcgi_pass_fpm;
  31. fastcgi_param PHP_ADMIN_VALUE "max_execution_time=240\nupload_max_filesize=128M\npost_max_size=128M";
  32. }
  33. {% endif %}
  34. }
  35. {% if phpmyadmin_ssl and ssl_certs_auto_installed.stdout_lines is defined and phpmyadmin_vhostname in ssl_certs_auto_installed.stdout_lines %}
  36. server {
  37. listen {% if phpmyadmin_vhostip %}{{ phpmyadmin_vhostip }}:{% endif %}{% if phpmyadmin_vhostport %}{{ phpmyadmin_vhostport }}{% else %}443{% endif %} ssl;
  38. server_name {{ phpmyadmin_vhostname }};
  39. include vhost_ssl_auto-{{ phpmyadmin_vhostname }};
  40. access_log /var/log/nginx/pma.access.log main;
  41. error_log /var/log/nginx/pma.error.log;
  42. root /usr/share/phpmyadmin;
  43. index index.php;
  44. try_files $uri $uri/ /index.php;
  45. {% if http_auth_phpmyadmin %}
  46. auth_basic "Restricted Access";
  47. auth_basic_user_file /etc/nginx/auth_admin;
  48. {% endif %}
  49. client_max_body_size 128m;
  50. location ~ \.php(/|$) {
  51. include fastcgi_pass_fpm;
  52. fastcgi_param PHP_ADMIN_VALUE "max_execution_time=240\nupload_max_filesize=128M\npost_max_size=128M";
  53. }
  54. }
  55. {% endif %}