You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks @nijel I'll check the version tomorrow. I thought I excuted docker pull phpmyadmin/phpmyadmin:latest today. I was wondering that my container ran with php command not nginx and supervisor. I might take some mistakes...
@nijel I feel that's understandable for me. I'd had old container at the moment so I did docker pull and docker rm -f container then docker-compose up. But there's no supervisor inside the container. I'd like to know your recommended tag, thanks.
Hi @nijel, I was wrong that I specified an old image in docker-compose.yml. I'm sorry to bother you. Now I launched the latest container Version 4.6.5.2. But PMA_ABSOLUTE_URI seemed not to work for subdirectory. I'm wondering where your subdirectory code is. My /etc/nginx.conf is completely same as its original, there's no alias. (I tried to add those lines but couldn't make it work... I've got to learn nginx first).
Could you tell me how you tried a web server to have an alias?
The PMA_ABSOLUTE_URI doesn't change the path where phpMyAdmin is served from the container (it's always on /), it's there for possibility to run it behind reverse proxy which will change the location.
Here phpMyAdmin would think it's running on http://1.2.3.4/, while the user sees it at https://host/some/path/. In such case setting PMA_ABSOLUTE_URI=https://host/some/path/ is needed.
Also, I set up reverse proxy to point phpMyadmin server with request URL's path to /phpmyadmin But the thing is phpMyAdmin launches at /. So I get 404 error when I access phpMyAdmin from browser with http://EXTERNAL_ADDRESS/phpmyadmin. I ran curl http://INTERNAL_PMA_ADDRESS/ and curl http://INTERNAL_PMA_ADDRESS/phpmyadmin on command line, and the latter one also returns 404 error
I tried to use PathPrefixStip option in reverse proxy. Then I can get index.php properly, but I get 400 error on static assets like CSS, JS, etc. So I think the only way is to make phpMyAdmin available at /phpMyAdmin. Is PMA_ABSOLUTE_URI option valid in 4.7.0 still?
UPDATE I will put request header when I'm trying to access phpMyAdmin at Chrome browser.
This is a request header for index.php with PathPrefixStrip enabled in reverse proxy.
The container will always serve phpMyAdmin on /, you need to rewrite the URL in your reverse proxy.
With haproxy example we have in configuration it is done by reqirep ^(GET|POST|HEAD)\ /phpmyadmin/(.*) \1\ /\2. If you can provide example for traefik we can include it in documentation as well.
Thanks in advance 👍 While I'm looking through docs, and checking timelines of resources when phpMyAdmin is requested, I just want to check one thing. As I said, I get index.php correctly, but when Stylesheet file is requested from index.php, it is requested as following URL.
If my assumption is right, there should be /phpmyadmin prefix in above path. Then the process would be like this.
Requesting CSS @ /phpmyadmin/phpmyadmin.css.php to traefik
--> Traefik stripts the prefix /phpmyadmin
--> Forwards the request with path /phpmyadmin.css.php to internal phpMyAdmin server.
--> Respond with stylesheet file
so, but how do I add this to the docker-compose file? I tried you image, but there apache fails to start.
@lug-gh: Create a new Dockerfile and paste the line of the Stackoverflow post from @laimison into it.
Modify your docker-compose.yml file:
phpmyadmin:
image: my-phpmyadmin #<--- Image name to buildbuild: <folder of Dockerfile> #<--- Folder without Dockerfile. See https://docs.docker.com/compose/compose-file/compose-file-v3/#build... config as usual ...
so, but how do I add this to the docker-compose file? I tried you image, but there apache fails to start.
@lug-gh: Create a new Dockerfile and paste the line of the Stackoverflow post from @laimison into it.
Modify your docker-compose.yml file:
phpmyadmin:
image: my-phpmyadmin #<--- Image name to buildbuild: <folder of Dockerfile> #<--- Folder without Dockerfile. See https://docs.docker.com/compose/compose-file/compose-file-v3/#build... config as usual ...
That way I have to build a new Dockerfile everytime I want to update? Thats not really a good solution in my opinion. Needs a lot of time and is laborious.
I just created a script fix_phpmyadmin which I run after upgrading/restarting the container.
so, but how do I add this to the docker-compose file? I tried you image, but there apache fails to start.
@lug-gh: Create a new Dockerfile and paste the line of the Stackoverflow post from @laimison into it.
Modify your docker-compose.yml file:
phpmyadmin:
image: my-phpmyadmin #<--- Image name to buildbuild: <folder of Dockerfile> #<--- Folder without Dockerfile. See https://docs.docker.com/compose/compose-file/compose-file-v3/#build... config as usual ...
That way I have to build a new Dockerfile everytime I want to update? Thats not really a good solution in my opinion. Needs a lot of time and is laborious.
I just created a script fix_phpmyadmin which I run after upgrading/restarting the container.
Set APACHE_ROOT_FOLDER to a value (example: /alernative-path/phpmyadmin), and both/ and /alernative-path/phpmyadmin/ will work
Was it the feature that is wanted ?
Because making / not work (404/403) is a bit more complicated and requires file system changes
Anyone, please let me know bout this :)
--- a/apache/docker-entrypoint.sh+++ b/apache/docker-entrypoint.sh@@ -35,6 +35,12 @@ if [ -n "${APACHE_PORT+x}" ]; then
sed -i "s/Listen 80/Listen ${APACHE_PORT}/" /etc/apache2/ports.conf
apachectl configtest
fi
++if [ ! -z "${APACHE_ROOT_FOLDER}" ]; then+ echo "Creating an alias for / to ${APACHE_ROOT_FOLDER}."+ sed -i "/DocumentRoot \/var\/www\/html/a \ Alias ${APACHE_ROOT_FOLDER} /var/www/html" /etc/apache2/sites-enabled/000-default.conf+ apachectl configtest+fi
# end: Apache specific settings
get_docker_secret() {
Set APACHE_ROOT_FOLDER to a value (example: /alernative-path/phpmyadmin), and both/ and /alernative-path/phpmyadmin/ will work
Was it the feature that is wanted ? Because making / not work (404/403) is a bit more complicated and requires file system changes
Anyone, please let me know bout this :)
--- a/apache/docker-entrypoint.sh+++ b/apache/docker-entrypoint.sh@@ -35,6 +35,12 @@ if [ -n "${APACHE_PORT+x}" ]; then
sed -i "s/Listen 80/Listen ${APACHE_PORT}/" /etc/apache2/ports.conf
apachectl configtest
fi
++if [ ! -z "${APACHE_ROOT_FOLDER}" ]; then+ echo "Creating an alias for / to ${APACHE_ROOT_FOLDER}."+ sed -i "/DocumentRoot \/var\/www\/html/a \ Alias ${APACHE_ROOT_FOLDER} /var/www/html" /etc/apache2/sites-enabled/000-default.conf+ apachectl configtest+fi
# end: Apache specific settings
get_docker_secret() {
this is much make sense and simple, already use this trick before using docker..
edit:
I am using nginx-proxy docker to handle all my apps proxy, and after I test this approach with domain that already have an app, the app become unreachable but the phpmyadmin is ok..
example: https://example.com => already have web app https://example.com/phpmyadmin => phpmyadmin
after I add https://example.com/phpmyadmin to the proxy, the https://example.com become 404 not found..
I had similar issues using nginx as reverse proxy directing to a docker container and using a subdir for the phpmyadmin url. If i didn't add a slash at the end of the url (https://www.example.org/phpmyadmin) I ended up with a blank page and alle external resources failed to load. Adding a slash at the end (https://www.example.org/phpmyadmin/) helped. I added this to the location part of the phpmyadmin-nginx-config-file: rewrite ^([^.]*[^/])$ $1/ permanent;
This seems to fix the problems.
But as I understand I have to set PMA_ABSOLUTE_URI = "https://host/some/path"
This makes running multiple containers on different hosts pretty unflexible, because we have to always modify the docker-compose file for each new instance, because of changed host name.
Is that correct, or do I miss something?
update
I could get it work with apache adding this to the vhosts config
# serve phpMyAdmin from subdirectoryProxyPass /pma http://phpmyadmin:80/
ProxyPassReverse /pma http://phpmyadmin:80/
Setups with different paths are quite difficult I agree.
The full URL seems correct to me, there is no base path handing.
By curiosity why do you need a proxy?
Could you please check #353 it would be nice having it merged
Activity
nijel commentedon Dec 15, 2016
Do you use latest version,
PMA_ABSOLUTE_URIsould be the way to do it, but it's not supported on anything older than 4.6.5.kujiy commentedon Dec 15, 2016
Thanks @nijel I'll check the version tomorrow. I thought I excuted
docker pull phpmyadmin/phpmyadmin:latesttoday. I was wondering that my container ran withphpcommand not nginx and supervisor. I might take some mistakes...nijel commentedon Dec 15, 2016
That sounds correcty, but if there is no supervisor, it's clearly some older version. Maybe I've made something wrong in the docker hub tags setup....
kujiy commentedon Dec 15, 2016
@nijel I feel that's understandable for me. I'd had old container at the moment so I did
docker pullanddocker rm -f containerthendocker-compose up. But there's no supervisor inside the container. I'd like to know your recommended tag, thanks.kujiy commentedon Dec 16, 2016
Hi @nijel, I was wrong that I specified an old image in
docker-compose.yml. I'm sorry to bother you. Now I launched the latest containerVersion 4.6.5.2. ButPMA_ABSOLUTE_URIseemed not to work for subdirectory. I'm wondering where your subdirectory code is. My/etc/nginx.confis completely same as its original, there's no alias. (I tried to add those lines but couldn't make it work... I've got to learn nginx first).Could you tell me how you tried a web server to have an alias?
nijel commentedon Dec 16, 2016
The
PMA_ABSOLUTE_URIdoesn't change the path where phpMyAdmin is served from the container (it's always on /), it's there for possibility to run it behind reverse proxy which will change the location.It's there for handing following setups:
Here phpMyAdmin would think it's running on
http://1.2.3.4/, while the user sees it athttps://host/some/path/. In such case settingPMA_ABSOLUTE_URI=https://host/some/path/is needed.kujiy commentedon Dec 16, 2016
I used phpmyadmin behind haproxy so tried to setup haproxy as a ProxyPass and works!
Here's my haproxy settings for subdirectoried phpmyadmin .
Here's docker-compose.yml for phpmyadmin.
Now they're working perfectly. Thank you very much. Would my settings be added to your document perhaps?
nijel commentedon Dec 16, 2016
Adding that to the docs could be useful, can you please document your setup for our docs? It's here: https://github.com/phpmyadmin/phpmyadmin/blob/master/doc/setup.rst#installing-using-docker
Add Docker sample for haproxy and subpath
lkaybob commentedon Apr 28, 2017
Hello, I'm using phpMyAdmin 4.7.0 on Docker along with traefik reverse proxy. I'm experiencing a similar issue on setting up subdirectory.
I used following
docker-compose.ymlfile, withPMA_ABSOLUTE_URLAlso, I set up reverse proxy to point phpMyadmin server with request URL's path to
/phpmyadminBut the thing is phpMyAdmin launches at/. So I get 404 error when I access phpMyAdmin from browser withhttp://EXTERNAL_ADDRESS/phpmyadmin. I rancurl http://INTERNAL_PMA_ADDRESS/andcurl http://INTERNAL_PMA_ADDRESS/phpmyadminon command line, and the latter one also returns 404 errorI tried to use
PathPrefixStipoption in reverse proxy. Then I can getindex.phpproperly, but I get 400 error on static assets like CSS, JS, etc. So I think the only way is to make phpMyAdmin available at/phpMyAdmin. IsPMA_ABSOLUTE_URIoption valid in 4.7.0 still?UPDATE I will put request header when I'm trying to access phpMyAdmin at Chrome browser.
This is a request header for
index.phpwithPathPrefixStripenabled in reverse proxy.and this is for
phpmyadmin.css, which returns 400 Bad Request errornijel commentedon Apr 28, 2017
The container will always serve phpMyAdmin on /, you need to rewrite the URL in your reverse proxy.
With haproxy example we have in configuration it is done by
reqirep ^(GET|POST|HEAD)\ /phpmyadmin/(.*) \1\ /\2. If you can provide example for traefik we can include it in documentation as well.lkaybob commentedon Apr 28, 2017
Thanks in advance 👍 While I'm looking through docs, and checking timelines of resources when phpMyAdmin is requested, I just want to check one thing. As I said, I get
index.phpcorrectly, but when Stylesheet file is requested fromindex.php, it is requested as following URL.If my assumption is right, there should be
/phpmyadminprefix in above path. Then the process would be like this.Requesting CSS @
/phpmyadmin/phpmyadmin.css.phpto traefik--> Traefik stripts the prefix
/phpmyadmin--> Forwards the request with path
/phpmyadmin.css.phpto internal phpMyAdmin server.--> Respond with stylesheet file
Is my assumption correct?
5 remaining items
laimison commentedon Aug 4, 2021
I have answered this here https://stackoverflow.com/a/68643939/5689995 in case you don't want to change reverse proxy configuration
williamdes commentedon Aug 4, 2021
Thank you
By the way be sure to change
FROM phpmyadmin/phpmyadmintoFROM phpmyadminto use the official imagelaimison commentedon Aug 4, 2021
Sure, post and image have been updated
lug-gh commentedon Sep 29, 2021
so, but how do I add this to the docker-compose file?
I tried you image, but there apache fails to start.
fishermans commentedon Feb 10, 2022
@lug-gh: Create a new Dockerfile and paste the line of the Stackoverflow post from @laimison into it.
Modify your docker-compose.yml file:
lug-gh commentedon Feb 11, 2022
That way I have to build a new Dockerfile everytime I want to update? Thats not really a good solution in my opinion. Needs a lot of time and is laborious.
I just created a script
fix_phpmyadminwhich I run after upgrading/restarting the container.Even thats not a good solution, but better than creating a new Dockerfile, I think.
fishermans commentedon Feb 11, 2022
No, it grabs the already existing image from docker hub and only applies the additional step at the end. So, it takes less than a few seconds.
Anyway, I will send a PR today to be able to configure the sub uri based on configuration without the need to re build any image.
williamdes commentedon Aug 11, 2022
I am re-opening because of #353
williamdes commentedon Aug 12, 2022
Very much simpler approach:
Set
APACHE_ROOT_FOLDERto a value (example:/alernative-path/phpmyadmin), and both/and/alernative-path/phpmyadmin/will workWas it the feature that is wanted ?
Because making
/not work (404/403) is a bit more complicated and requires file system changesAnyone, please let me know bout this :)
biladina commentedon Oct 28, 2022
this is much make sense and simple, already use this trick before using docker..
edit:
I am using nginx-proxy docker to handle all my apps proxy, and after I test this approach with domain that already have an app, the app become unreachable but the phpmyadmin is ok..
example:
https://example.com=> already have web apphttps://example.com/phpmyadmin=> phpmyadminafter I add
https://example.com/phpmyadminto the proxy, thehttps://example.combecome 404 not found..scotty86 commentedon Sep 29, 2023
I had similar issues using nginx as reverse proxy directing to a docker container and using a subdir for the phpmyadmin url. If i didn't add a slash at the end of the url (https://www.example.org/phpmyadmin) I ended up with a blank page and alle external resources failed to load. Adding a slash at the end (https://www.example.org/phpmyadmin/) helped. I added this to the location part of the phpmyadmin-nginx-config-file:
rewrite ^([^.]*[^/])$ $1/ permanent;This seems to fix the problems.
tswaehn commentedon Feb 17, 2024
I am wondering why
PMA_ABSOLUTE_URIhas to be the full uri. Shouldnt it be only the relativ path behind the host?looking at your example above:
I would expect
PMA_ABSOLUTE_URI = "/some/path"But as I understand I have to set
PMA_ABSOLUTE_URI = "https://host/some/path"This makes running multiple containers on different hosts pretty unflexible, because we have to always modify the docker-compose file for each new instance, because of changed host name.
Is that correct, or do I miss something?
update
I could get it work with apache adding this to the vhosts config
in docker compose:
williamdes commentedon Mar 6, 2024
Hello @tswaehn
Setups with different paths are quite difficult I agree.
The full URL seems correct to me, there is no base path handing.
By curiosity why do you need a proxy?
Could you please check #353 it would be nice having it merged