How to Install and Secure phpMyAdmin on Ubuntu 22.04?


Share:
 | Published By: Admin | Published On: Jun 22, 2022 | Category: Ubuntu

Hi Guys,

This example is focused on Secure phpMyAdmin Access with Apache on Ubuntu. if you have question about How To Install and Secure phpMyAdmin on Ubuntu 22.04? then I will give simple example with solution. We will use Ubuntu 22.04 Secure phpMyAdmin. you'll learn Secure an phpMyAdmin on Ubuntu 22.04.

You can use this post for ubuntu 14.04, ubuntu 16.04, ubuntu 18.4, ubuntu 20.04, ubuntu 21 and ubuntu 22.04 versions.

you can see the following two solutions to secure PHPMyAdmin login

Solution 1: Change PhpMyAdmin Login Page URL in Apache 2 Ubuntu

The default phpmyadmin login url can be located on apache named apache.conf

You can use the sudo nano /etc/phpmyadmin/apache.conf command to open the apache.conf file:

sudo nano /etc/phpmyadmin/apache.conf

You can attach the following line to the phpmyadmin url:

Alias /my-phpmyadmin /usr/share/phpmyadmin

Type the following command on your ssh terminal to restart the Apache service:

sudo service apache2 restart
Solution 2: Secure PHPMyAdmin Access in ubuntu aws

Open terminal and create a password using the htpasswd tool and Apache package following command.

sudo htpasswd -c /etc/phpmyadmin/.htpasswd myAdmin

can add password and confirm password here

New password:
Re-type new password:
Adding password for user myAdmin

Type the following command to open the phpmyadmin.conf file.

sudo nano /etc/apache2/conf-available/phpmyadmin.conf

Add the following lines to the phpmyadmin.conf file and save it:

Options  +FollowSymLinks +Multiviews +Indexes  # edit this line
DirectoryIndex index.php

AllowOverride None
AuthType basic
AuthName "Authentication Required"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user

Restart the Apache web server using the following command:

sudo service apache2 restart
Share: