This commit is contained in:
phil 2024-01-04 08:05:08 +01:00
parent b34f00fbb8
commit 6dc11ec24e
12 changed files with 162 additions and 80 deletions

23
templates/fpmpool.j2 Normal file
View file

@ -0,0 +1,23 @@
[global]
error_log = ${FPM_ERROR_LOG}
[{{ phpmyadmin_user }}]
listen = ${FPM_SOCKET_PATH}
pm = ondemand
pm.max_children = 10
pm.process_idle_timeout = 10s
pm.max_requests = 200
pm.status_path = /status
chdir = /
clear_env = no
security.limit_extensions = .php .php3 .php4 .php5
php_admin_value[cgi.fix_pathinfo] = 0
php_admin_value[opcache.enable] = 1
php_admin_value[opcache.validate_permission] = 1
php_admin_value[opcache.validate_root] = 1
php_admin_value[session.cookie_samesite] = Lax
php_admin_value[openssl.capath] = /etc/ssl/certs
php_flag[display_errors] = off
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 256M
php_admin_value[disable_functions] = mail,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_exec,passthru,system,proc_get_status,proc_close,proc_nice,proc_terminate,proc_open,curl_ini,parse_ini_file,show_source,dl,symlink,system_exec,exec,shell_exec,phpinfo

View file

@ -1,32 +0,0 @@
server {
listen 80;
server_name {{ phpmyadmin_domain }};
include snippets/letsencrypt.conf;
location / { return 301 https://$http_host$request_uri; }
}
server {
listen 443 ssl http2;
server_name {{ phpmyadmin_domain }};
ssl_certificate /var/lib/dehydrated/certs/{{ phpmyadmin_domain }}/fullchain.pem;
ssl_certificate_key /var/lib/dehydrated/certs/{{ phpmyadmin_domain }}/privkey.pem;
include /etc/nginx/snippets/add_headers.conf;
auth_basic "Restricted Access Only";
auth_basic_user_file {{ phpmyadmin_htpasswd_file }};
root /usr/share/phpmyadmin;
index index.php index.html index.htm;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php/php{{ php_version.stdout }}-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~ \.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
root /usr/share/phpmyadmin;
}
}

24
templates/pma.php.j2 Normal file
View file

@ -0,0 +1,24 @@
{{ ansible_managed | comment }}
<?php
$cfg['ForceSSL'] = true;
{% if phpmyadmin_hosts is defined %}
$i = 0;
$hosts = array (
{% for host in phpmyadmin_hosts %}
"{{ host.name }}" => "{{ host.address }}",
{% endfor %}
);
foreach ($hosts as $verbose => $host) {
$i++;
$cfg['Servers'][$i]['verbose'] = $verbose;
$cfg['Servers'][$i]['host'] = $host;
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['compress'] = FALSE;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
}
{% endif %}