Friday, December 22, 2023

How to Install phpMyAdmin with Nginx in ubuntu

PhpMyAdmin is a free and open-source web-based database management tool written in PHP. It provides a graphical web interface for users to manage MySQL or MariaDB database.


Step 1: Download and Install phpMyAdmin on Ubuntu 20.04

$ sudo apt update

$ sudo apt install phpmyadmin

  • The above command will install all necessary dependencies including PHP7 extensions. During the installation, it will ask if you want to use dbconfig-common to configure the database. Press Tab key to select Yes.

  • This will also create a new database user named phpmyadmin. Give this user a password.
  • Example :  123456

  • Next, it will prompt you to select a web server to configure. Nginx isn’t on the list, so press the Tab key and hit OK to skip this step.

Step 2: Create Nginx virtual host file for phpMyAdmin.

$ sudo vim /etc/nginx/sites-available/phpmyadmin.conf

  • Paste the following text into the file.

sudo ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/

$ sudo nginx -t

$ sudo systemctl reload nginx


Step 3: Please add the domain name to the /etc/hosts file, specifically if you're performing this action on a local system.

$ sudo vim /etc/hosts

  • 127.0.0.1    phpmyadmin.local

 

  • Now you should be able to access phpMyAdmin web interface via





No comments:

Post a Comment

testing