Phpmyadmin one install for all domains

I had a need for a link to be added to the virtualmin menu to phpmyadmin … easy you might say just install phpmyadmin & add the link … nope I ran into all sorts of errors with suexec etc … but I got around it this way

  1. setup a dummy domain (I have one for my mail server to get ssl certs this goes back before cheap wildcard certs) and install phpmyadmin there either at top level or in directory
  2. test it works
  3. redirect the url somewhere else using virtualmin->domain->Server Configuration->Website Redirects
  4. create a new file in your apache2 sites-available folder (i called it phpmyadmin) and add the following to it

<VirtualHost domain.com:9999>
SuexecUserGroup #1000 #1000 #user & group of where phpmyadmin is installed
DocumentRoot /home/phpmyadmin/public_html/phpmyadmin #where phpmyadmin is installed
ErrorLog /var/log/virtualmin/phpmyadmin_error_log #phpmyadmin error log
CustomLog /var/log/virtualmin/phpmyadmin_access_log combined #phpmyadmin access log
ErrorDocument 400 https://domain.com:9999/ # use this if serving https to catch http requests
IPCCommTimeout 31
php_admin_value engine Off
SSLEngine on
SSLCertificateFile /home/user/ssl.cert # path to virtual host ssl cert
SSLCertificateKeyFile /home/user/ssl.key # path to virtual host ssl key
SSLCACertificateFile /home/user/ssl.ca # path to virtual host ssl ca
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 # protocols
<Directory /home/phpmyadminuser/public_html/phpmyadmin> # where phpmyadmin is installed
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php7.2
FCGIWrapper /home/phpmyadminuser/fcgi-bin/php7.2.fcgi .php
FCGIWrapper /home/phpmyadminuser/fcgi-bin/php7.2.fcgi .php7.2
</Directory>
ServerName domain.com
</VirtualHost>
changing all the text noted above to the correct values, don’t forget to use a valid port and to make sure
the firewall is not blocking it then use a2ensite to enable the conf
5. edit apache ports.conf and add the port number to it e.g Listen 9999 save and restart apache
6. test the url e.g https://domain.com:9999 if this works we are nearly done
7. use virtualmin->system customization->custom links
add a new link like https://$DOM:9999 or http://$DOM:9999 where 9999 is your selected port
and add it to a Category if you like
All domains will default to this domain if you navigate to another domain on the same port e.g domain1.com:9999 will show domain.com:9999 to show the actual domain create another virtual host block as above but change the ssl locations, server name and error document.
don’t forget to put the correct paths in for phpmyadmin & user :grinning:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.