Allow access to PhpMyadmin only on a specified virtualhost
Remove the Alias declaration
Alias /phpmyadmin /usr/share/phpmyadmin
from the server context and put it in the relevant vhost context
<VirtualHost *:80>
ServerName onlyphpmyadmin.domain.com
.
.
.
Alias /phpmyadmin /usr/share/phpmyadmin
</VirtualHost>
It may be easier and preferable to just include the whole phpmyadmin config into the relevant vhost
<VirtualHost *:80>
ServerName onlyphpmyadmin.domain.com
.
.
.
include /path/to/phpmyadmin.conf
</VirtualHost>
and then remove that include from the server context and restart apache for the changes to take affect.
In RHEL/CentOS, Apache loads /etc/httpd/conf.d/phpmyadmin.conf to set up the /phpmyadmin alias. The Directory directive is also initially set to only allow traffic from localhost, so you may receive a 403 error when accessing phpmyadmin like "domain.com/phpmyadmin".
Using the following, you can set up RHEL/CentOS to only allow the /phpmyadmin alias to work from a specific virtual host.
/etc/httpd/conf.d/phpmyadmin.conf
<Directory "/usr/share/phpmyadmin">
# Order Deny,Allow
# Deny from all
Allow from 127.0.0.1
</Directory>
#Alias /phpmyadmin /usr/share/phpmyadmin
#Alias /phpMyAdmin /usr/share/phpmyadmin
#Alias /mysqladmin /usr/share/phpmyadmin
Next, add the alias directive to your vhost and restart Apache.
Please note, this is not the most secure implementation. Please take care to secure /phpmyadmin through authentication, IP restrictions or a combination of both.