I'm new to Docker and I'm encountering difficulties configuring PHPMyAdmin with Docker Compose to work with HTTPS on localhost on port 8443
. I've managed to set up PHPMyAdmin with Docker Compose and make it accessible via HTTP on port 8080
. However, I also want to replicate the production environment using HTTPS. In the end, I need a MySQL container on port 3306
SSL linked to a PHPMyAdmin container on port 8443
and a Prestashop container on port 8000
.
I checked my SSL configuration in the config.user.inc.php
file and in the PHPMyAdmin container configuration, but I couldn't resolve the issue. I also came across suggestions indicating that SSL certificates need to be generated, but I haven't found specific resources on generating certificates for localhost in a Docker environment.
Here are my current files:
.env
HTTP_PORT=80SSL_PORT=443DB_SERVER=mysqlDB_PORT=3306DB_NAME=3majDB_USER=3majDB_PASSWORD=passwordPMA_PORT=8080PMA_SSL_PORT=8443
docker-compose.yml
version: "3.9"networks: 3maj:volumes: dbdata:services: mysql: image: mysql container_name: 3maj-mysql restart: unless-stopped networks: - 3maj volumes: - dbdata:/var/lib/mysql environment: MYSQL_RANDOM_ROOT_PASSWORD: 1 MYSQL_DATABASE: ${DB_NAME} MYSQL_USER: ${DB_USER} MYSQL_PASSWORD: ${DB_PASSWORD} MYSQL_ALLOW_EMPTY_PASSWORD: 'no' phpmyadmin: image: phpmyadmin container_name: 3maj-phpmyadmin restart: unless-stopped networks: - 3maj links: - mysql depends_on: - mysql ports: - ${PMA_PORT}:443 - ${PMA_SSL_PORT}:80 volumes: - ./config.user.inc.php:/etc/phpmyadmin/config.user.inc.php environment: PMA_HOST: ${DB_SERVER} PMA_USER: ${DB_USER} PMA_PASSWORD: ${DB_PASSWORD}
config.user.inc.php
<?php$i = 1;$cfg['ForceSSL'] = true;$cfg['Servers'][$i]['ssl'] = true;$cfg['Servers'][$i]['ssl_verify'] = true;
Can someone please tell me how to make it work?