Thursday, December 26, 2024
Google search engine
HomeGuest BlogsHow to Secure phpMyAdmin Access with Apache on Ubuntu 18.04/20.04

How to Secure phpMyAdmin Access with Apache on Ubuntu 18.04/20.04

How to secure PHPMyAdmin login access in ubuntu apache on aws. Here, we will show you a simple 2 solution to secure PHPMyAdmin login in ubuntu apache on aws web server.

The first solution is to change the PHPMyAdmin login URL. And the second solution is add an extra security layer for access PHPMyAdmin login url in ubuntu 18.04 apache 2 on aws. And prevent the attacks.

Because by default, phpmyadmin login url is located on http:///phpmyadmin. So, The main reason of change phpmyadmin login url in ubuntu apache aws server to prevent attackers attack.

How to Secure phpMyAdmin with Apache 2 on Ubuntu 18.04

Now, you can see the following two solutions to secure PHPMyAdmin login access in ubuntu apache 2 on aws server.

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

In ubuntu, default phpmyadmin login url can be located at apache configuration that name apache.conf.

So, you can use sudo nano /etc/phpmyadmin/apache.conf command to open apache.conf file:

sudo nano /etc/phpmyadmin/apache.conf

Then, you can add the following line with your phpmyadmin url:

Alias /my-phpmyadmin /usr/share/phpmyadmin

Note that, you can replace my-phpmyadmin to your own word.

Now you need to restart apache 2 web server. So type the following command on your ssh terminal to restart apache service:

sudo service apache2 restart

Solution 2 – Secure PHPMyAdmin Access in ubuntu aws

Now, you can add extra security layer for access phpmyadmin login in ubuntu apache 2 on aws web server.

So, first of all, you need to create a password file with users using the htpasswd tool that comes with the Apache package. So open your ssh terminal and type the following command:

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

Note that, You can choose any username instance of myAdmin with above command.

After that, one prompt box appear with password and confirm password. So, you can add password and confirm password here.

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

Now, you need to configure Apache 2 to password protect the phpMyAdmin directory and use the .htpasswd file.

So, open your ssh terminal and type the below command to open the phpmyadmin.conf file.

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

Then add the following lines in 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

Finally, restart apache web server by using the following command:

sudo service apache2 restart

Recommended Posts

RELATED ARTICLES

Most Popular

Recent Comments