How to set up PhpMyAdmin with MariaDB on Portainer with NGINX Proxy Manger .

I love PhpMyAdmin because it was straightforward to set up for any app and fix the table database or troubleshoot. So, we will set up PhpMyAdmin with nginx SSL secure for our HTTPS. We would rather not expose this on HTTP due to grabber username and password exploits…

Make sure you do this first! Before starting build this because this tutorial is always requirement to make app prevent hack and expose our port to the public… we don’t want that to happen. We only want open 80 and 443 that it.

How to set up Portainer with nginx Proxy Manager — Applegate’s IT and Network (x4-applegate.com)

After you complete Portainer and nginx, then we are good to go to build this app with nginx and PhpMyAdmin.

Open Portainer → Stacks→ create stacks

version: '3'
services:
  pma:
    networks:
      - nginx
      - mariadb
    image: phpmyadmin/phpmyadmin
    container_name: pma
    environment:
      PMA_ARBITRARY: 1
    restart: always
    #ports:
     # - 8081:80
networks:
  nginx:
    external: true
  mariadb:
    external: true

I added hashtag comments on ports and Port number because we don’t need these, and we just will use nginx network on this app. So, nginx proxy can communicate with PhpMyAdmin instead of port or public. It more secure to build our app before publishing to the public. They can inject your sites with HTTP or any insecure port.

Then deploy the stacks and now your PhpMyAdmin is online but will not show up on site because you haven’t set up nginx Proxy details. So that our next step.

Open nginx proxy manager your site. My will be nginxadmin.richardapplegate.io.

Then you will need to log in to your admin account. Then add proxy host, then fill this detail.

I set pma on forward hostname/IP because I set docker-compose on PhpMyAdmin container_name is pma. And this app expose 80 on nginx network. Port and expose are different. Port is going to communicate with the outside internet. Expose is the PhpMyAdmin already created image and inside developer build image expose 80, so we know what is exposed, and we put expose port on forward port.
Make sure you enable SSL and HTTP/2 and HSTS.

Now you may open your site with a domain without port. My will be phpmyadmin.richardapplegate.io. and working!

Server: your database container_name on docker-compose. Mine is mariadb
Username: your primary account for all database control. Mine is root.
Password: you create the password and the password should on your docker-compose. You won’t be possible to log in my PhpMyAdmin because 3 times incorrect information, then you will be banned. You won’t access from my server or see my sites anymore for 1 week.

Then you are in database MariaDB system

“SSL is not being used” is normal because itself PhpMyAdmin is not on public, it is on nginx proxy manager. So, PhpMyAdmin is not public, it is full secured under the nginx. And you can see that we can create databases or tables or control user accounts.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *