Limit phpMyAdmin Installed by Apt to One Apache Virtual Host

Limit phpMyAdmin Installed by Apt to One Apache Virtual Host

I've got several Virtual host setup on my web server and I only want one of them to be able to access the phpMyAdmin install?

Ubuntu version 16.04

I got on my server setup with 3 vhost that are:
example1.domain.local
example2.domain.local
example3.domain.local

Now if I enter in my web browser any of those with /phpmyadmin I get the phpmyadmin login but I only what to be able to access it from

Fix by removing phpmyadmin.conf using a2disconf. Then edited etc/apache2/sites-enabled/example3.conf

Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
</Directory>
2

1 Answer

Disable phpmyadmin in apache2.conf. Enable in virtual host for you choice.

phpMyAdmin /etc/apache2/sites-enabled/yourvirtualhost.conf

Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
</Directory>
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sophia Al-Mansoor
Author

Sophia Al-Mansoor

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.