How to change the access url of official phpmyadmin docker image to http://localhost/phpmyadmin?
I would not recommend to solve this issue in Nginx. It could be error prone, especially if someone does reverse proxy.
It seems official phpmyadmin image is based on Apache.
Unfortunately, as of 2021 phpmyadmin cannot be served from /phpmyadmin
So you have to build additional layer by yourself:
FROM phpmyadminRUN mv /var/www/html /var/www/phpmyadminRUN mkdir -p /var/www/htmlRUN mv /var/www/phpmyadmin /var/www/html/phpmyadmin
Or you can use image which does same for you:
laimison/phpmyadmin:latest
Off topic: if someone asks what configuration is sufficient in reverse proxy:
location /phpmyadmin { proxy_pass http://pma:80; proxy_set_header Host $http_host; break; }
That's it.
You could try and simply change location / {
with an alias
directive:
location /phpmyadmin/ { alias /www; ...
That would serve the same root files, but only for the url http://localhost/phpmyadmin
Regarding docker, it means you need to docker build your own image, with a Dockerfile starting with FROM phpmyadmin/phpmyadmin:4.6
, and COPYing a modified version of nginx.conf
, a bit like this 3bdigital/docker-phpmyadmin
repo.
The OP faraday chose the simpler approach of:
build(ing) a docker image myself with ubuntu as base image and phpmyadmin installed.
It works underhttp://localhost/phpmyadmin
after installation.