Usually, we are getting access to phpmyadmin http://localhost/phpmyadmin and we are pass user name and password.
1.localhost/phpmyadmin/
for cloud: 2.125.125.14.12/phpmyadmin
so its easy to hacker to crack it. How we can secure phpmyadmin by using .htaccess file?
Note: its for ubuntu
I am assuming that you have installed mysql.
Install phpmyadmin:
sudo apt-get install phpmyadmin
Copy:
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-enabled/phpmyadmin.conf
Edit:
sudo nano /etc/apache2/conf-enabled/phpmyadmin.conf
enter following line just after "DirectoryIndex index.php
":
AllowOverride All
Edit .htaccess
sudo nano /usr/share/phpmyadmin/.htaccess
Enter following content:
AuthType Basic
Authname "Restricted files"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user
sudo apt-get install apache2-utils
sudo htpasswd -c /etc/phpmyadmin/.htpasswd username
Enter new password
Restart apache
sudo service apache2 restart
Use the order way, ie:
<Directory "/path/to/phpmyadmin">
order deny,allow
deny from all
allow from 127.0.0.1
</Directory>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With