Hello,
The compose file looks like this:
phpmyadmin:
image: phpmyadmin:latest
container_name: phpmyadmin
restart: unless-stopped
# network_mode: host
environment:
PMA_HOST: host.docker.internal
MYSQL_ROOT_PASSWORD: 123456
ports:
- "127.0.0.1:8080:80"
extra_hosts:
- "host.docker.internal:host-gateway"
The Nginx configuration is as follows:
...
location /phpmyadmin/ {
proxy_pass http://127.0.0.1:8080/; # Matches your compose port binding
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Script-Name /phpmyadmin; # Critical for path handling
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Buffer settings
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
# Security headers
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection "1; mode=block";
}
# Redirect /phpmyadmin to /phpmyadmin/
location = /phpmyadmin {
return 301 /phpmyadmin/;
}
MariaDB is also running on the host as follows:
# netstat -tulnp | grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 3248362/mariadbd
When I enter my username and password in PhpMyAdmin, I get the following error:
mysqli::real_connect(): (HY000/2002): No route to host
Thank you.