How To Secure phpMyAdmin using Command with Apache on Ubuntu 22.04 ?

Today now in this tutorial, i will show you How to Install and also make Secure phpMyAdmin with Apache on Ubuntu 22.04? Here i will be explain this step by step How we can make phpMyAdmin Secure with Apache on Ubuntu 22.04. Now in this article i will goes in detailed on Ubuntu 22.04 Secure phpMyAdmin. So it This tutorial i will be give you simple an example of Ubuntu 22.04 Secure and also Access phpMyAdmin.

we can also use this post for any version ubuntu 14.04, ubuntu 16.04, ubuntu 18.4, ubuntu 20.04, ubuntu 21 and ubuntu 22.04 .

we can see in the following two solutions to secure PHPMyAdmin login.

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

For the default phpmyadmin login url we can be located on apache named apache.conf

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

sudo nano /etc/phpmyadmin/apache.conf

we can also attach the following line to the phpmyadmin url:

Alias /my-phpmyadmin /usr/share/phpmyadmin

Now need to type the following command on our ssh terminal for restart the Apache service:

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

Now need to open terminal and then create a password by using the htpasswd tool and Apache package following the command.

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

we can also add password and confirm password here

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

Need to type the following command for open the phpmyadmin.conf file.

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

So now need to add the following lines to the phpmyadmin.conf file and then 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

Finally need to restart the Apache web server by using the following command:

sudo service apache2 restart

Read Also: How to create Customize pagination templates in Laravel 8?

Thanks for read. I hope it help you. For more you can follow us onĀ facebook

About Md. Mostofa Kamal

My name is Md. Mostofa Kamal. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help other developers. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS, and Bootstrap from the early stage.

View all posts by Md. Mostofa Kamal →