Page 1 of 1

Can I stop phpmyadmin from being accessed by IP address?

Posted: Wed Feb 08, 2023 9:20 am
by dle001
Hi

I want to stop access phpmyadmin via ip address. (maybe better for stopping attackers)

How to fix it ?
Thank you

Re: How to stop access phpmyadmin via ip address ?

Posted: Wed Feb 08, 2023 9:48 am
by myVesta
Currently there is no way to do that.
But you can 'assign' phpmyadmin to some subdomain that is known only to you - viewtopic.php?f=8&t=37
The same way (set 'group=youruser' in fpm conf) you can 'unassign' the phpmyadmin from hostname, to stop bots.

Re: How to stop access phpmyadmin via ip address ?

Posted: Tue Feb 14, 2023 3:55 am
by ikheetjeff
I did it this way:

File: /etc/apache2/conf.d/phpmyadmin.conf

Add this code:

Code: Select all

RewriteEngine On
RewriteCond %{HTTP_HOST} !sub.domain.com$ [OR]
RewriteCond %{REMOTE_ADDR} !^00.00.00.00
RewriteRule (.*) - [R=404]
sub.domain.com is the only domain where phpmyadmin works and 00.00.00.00 is only ip.
I use vesta for myself, which allows for this. if you have multiple users this does not work.