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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like