I stumbled on this question while trying to achieve this, inside a Kubernetes environment.
The question, docker-style is opened here https://github.com/phpmyadmin/docker/issues/253.
I read it. Works with pure docker, but not 100% applicable to k8s though.
With k8s, the $document_root
can't be mounted inside the nginx container, as it is strictly inside phpmyadmin container (the /var/www/html
).
So nginx fails to serve the static parts.
PHP code is well served by the FPM, no problem with that, I receive a 200 OKGET /index.php HTTP/1.1" 200 3600
But every other resources end up with a 404 as they are not served by the FPM (not his job), nor by nginx (it doesn't have them locally).
My question would be :
How to achieve this usecase [nginx] -> [phpmyadmin:fpm]
in a Kubernetes environement
Corollary question :
Is there something wrong in my approach, or in my conf ?
For reference:
nginx.conf
server {
listen 80;
server_name pma.exemple.com;
location ~ /.*\.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_pass backend-phpmyadmin-service:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
deployment-pma.yaml
[...]
containers:
- name: backend-phpmyadmin
image: phpmyadmin/phpmyadmin:fpm-alpine
env:
- name: PMA_HOST
value: backend-mariadb
- name: PMA_PORT
value: '3306'
- name: PMA_ABSOLUTE_URI
value: 'http://pma.exemple.com/'
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: backend-mariadb-secret
key: pass
service-pma.yaml
apiVersion: v1
kind: Service
metadata:
name: backend-phpmyadmin-service
[...]
ports:
- protocol: TCP
port: 9000