How To
- Buat file
docker-compose.yml
services:
pma:
image: phpmyadmin:latest
container_name: pma-ctr
restart: always
logging:
driver: none
environment:
##buat multiple hosts
##127.0.0.1,192.168.1.1
- PMA_HOSTS=127.0.0.1
##utk portnya berurutan
##3306,7878 bearti 127.0.0.1:3306, 192.168.1.1:7878
- PMA_PORTS=3306
- HIDE_PHP_VERSION=true
##tanpa subpath, hapus aja subpath nya
- PMA_ABSOLUTE_URI=https://ipang.my.id/phpmyadmin
- TZ=Asia/Jakarta
##change default port
- APACHE_PORT=666
##easier to setup firewall rule, so use host mode
network_mode: host
-
Run dengan
docker-compose up -d
-
Untuk setup reverse proxy di nginx tanpa subpath
location / {
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/.htpasswd-phpmyadmin;
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
proxy_http_version 1.1;
proxy_pass http://localhost:666;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 3m;
proxy_send_timeout 3m;
proxy_read_timeout 3m;
}
- Setup nginx dengan subpath
location /phpmyadmin {
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/.htpasswd-phpmyadmin;
rewrite ^/phpmyadmin(/.*)$ $1 break;
proxy_pass http://localhost:666;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_connect_timeout 3m;
proxy_send_timeout 3m;
proxy_read_timeout 3m;
}