1

I am relative new and learning about linux servers. I just played with them years ago.

I have configured Apache2, Php5, MySQL, PhpMyAdmin, etc. on a Raspberry using Raspbian (Debian dist).

I just configured some virtualhost where I am going to work, and now I want to know if I could configure each virtualhost to have their specific phpmyadmin access and databases.

I googled for hours but I have found nothing.

Thank you! :)

migrated from serverfault.com Jun 5 '17 at 9:24

This question came from our site for system and network administrators.

  • hi, i think it should be possible, you can put a phpmyadmin in each "folder" you want, and just configure it from there calling the config page. – olivierg Jun 5 '17 at 8:50
1

You could create a private DNS server as you used raspberry to access DNS, setting your raspberry IP address to resolve domains. After apache, set the ServerName directive to phpmyadmin.xx.com and ServerAlias www.phpmyadmin.xx.com. When you create a DNS server using Bind9, you can use any name because it is private and then solves only if you have your ip configured as DNS on the client computer. You could do the same thing by using a server and buying a domain. Post Apache2 Configuration

<VirtualHost *:80> 
     ServerName phpmyadmin.xxx.com
     ServerAlias www.phpmyadmin.xxx.com
     ServerSignature Off
     LogLevel warn
     ErrorLog /var/log/apache2/error.log
     CustomLog /var/log/apache2/access.log combined
     DocumentRoot /usr/share/phpmyadmin/
     # Secure your directory
     <Location />
        Options -Indexes
     </Location>
     # End Secure
     <Directory /usr/share/phpmyadmin/>
          Options +MultiViews +FollowSymLinks
          AllowOverride All # Enable .htaccess
          DirectoryIndex index.html index.htm index.php # Set file default
          Order allow,deny # Access Directory
          Allow from all # Access All 
          # or access you ip
          Allow from <you private/public ip>
     </Directory>
</VirtualHost>  
  • Uhm. I do not want a DNS, because I am accessing through Internet. I am the domains owner. – Jordi Huertas Jun 5 '17 at 9:09
  • Ok, I have posted the configuration of apache2 is valid even if you do not want to use a subdomain, just remove ServerName and ServerAlias – Riccardo Pugliese Jun 5 '17 at 9:17
  • Hey @Riccardo, sorry for a late response, but I forgot this question and I have found another solution: I am posting it as answer – Jordi Huertas Nov 1 '17 at 17:48
1

I made this question in more than 1 stackexchange site because in 2 sites people told that was the wrong site, and I forgot this one. But the same question is solved here. Below is a copy of the accepted answer:


phpMyAdmin is available to every host via alias on addres mysite.com/phpmyadmin, and if u add databases and users, then restrict users to view only certain databases, when they login, they will see only one database. And if u want to allow phpmyadmin for certain websites remove this line

Alias /phpmyadmin /usr/share/phpmyadmin

from

/etc/phpmyadmin/apache2.conf

and add this to vhost of site you want to enable it

<VirtualHost *:80>
    ServerName onlyphpmyadmin.domain.com
    .
    .
    .
    Alias /phpmyadmin /usr/share/phpmyadmin
</VirtualHost>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.