Skip to content

Commit

Permalink
Add Docker sample for haproxy and subpath
Browse files Browse the repository at this point in the history
Fixes phpmyadmin/docker#101

Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Feb 6, 2017
1 parent 0d9c110 commit f26d745
Showing 1 changed file with 52 additions and 1 deletion.
53 changes: 52 additions & 1 deletion doc/setup.rst
Expand Up @@ -293,7 +293,7 @@ arbitrary server - allowing you to specify MySQL/MariaDB server on login page.
Customizing configuration file using docker-compose
---------------------------------------------------

You can use external firle to customize phpMyAdmin configuration and pass it
You can use external file to customize phpMyAdmin configuration and pass it
using volumes directive:

.. code-block:: yaml
Expand All @@ -310,6 +310,57 @@ using volumes directive:
- /sessions
- ~/docker/phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
Running behind haproxy in a subdirectory
----------------------------------------

When you want to expose phpMyAdmin running in a Docker container in a
subdirectory, you need to rewrite the request path in the server proxying the
requests. For example using haproxy it can be done as:

.. code-block:: text
frontend http
bind *:80
option forwardfor
option http-server-close
### NETWORK restriction
acl LOCALNET src 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12
# /phpmyadmin
acl phpmyadmin path_dir /phpmyadmin
use_backend phpmyadmin if phpmyadmin LOCALNET
backend phpmyadmin
mode http
reqirep ^(GET|POST|HEAD)\ /phpmyadmin/(.*) \1\ /\2
# phpMyAdmin container IP
server localhost 172.30.21.21:80
You then should specify :envvar:`PMA_ABSOLUTE_URI` in the docker-compose
configuration:

.. code-block:: yaml
version: '2'
services:
phpmyadmin:
restart: always
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
hostname: phpmyadmin
domainname: example.com
ports:
- 8000:80
environment:
- PMA_HOSTS=172.26.36.7,172.26.36.8,172.26.36.9,172.26.36.10
- PMA_VERBOSES=production-db1,production-db2,dev-db1,dev-db2
- PMA_USER=root
- PMA_PASSWORD=
- PMA_ABSOLUTE_URI=http://example.com/phpmyadmin/
.. _quick_install:

Expand Down

0 comments on commit f26d745

Please sign in to comment.