How to set up phpMyAdmin with Virtualmin/vhosts?

15 posts / 0 new
Last post
#1 Sun, 06/21/2009 - 11:01
pcm2a

How to set up phpMyAdmin with Virtualmin/vhosts?

Maybe this is super simple and I've just missed something. My users are already used to using phpmyadmin in Plesk so I hate to take that tool away from them.

I installed in Ubuntu 8.04 using apt-get install phpmyadmin. I see config files in /etc and the programs files in /usr/share/phpmyadmin. I am unsure how to even access the utility past this (I did try various combos like ipaddress/phpmyadmin).

Will I be able to run one copy of this that all vhosts use? Accessing with ipaddress/phpmyadmin or their_domain.com/phpmyadmin? Either way would be ok, as long as they can log in with their mysql username/passwords.

Any tips on setting this up?

I assume the alternative is to manually install a copy in every single vhost, which seems crummy!

Thanks!

Sun, 06/21/2009 - 11:20
ronald
ronald's picture

actually the best way is to install it in your domain, like your systems hostname under ssl. Even per haps make a sub server. https://phpmyadmin.yourserver.com

then all clients just connect to that securely.

also you can make a rewrite rule much as already exist in the server template but then for phpmyadmin. your clients go to phpmyadmin.clientsdomain.com but end up at your url.

Sun, 06/21/2009 - 16:02 (Reply to #2)
pcm2a

Thanks, those seem like pretty good suggestions and I think I may try to set it up like that. I haven't started working on anything secure, but I'd like to.

For the moment I found that if I edited /etc/apache2/mods-available/alias.conf and added these lines: Alias /phpmyadmin/ "/usr/share/phpmyadmin/"

Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all

It will now redirect any and all vhosts there using http://domain.com/phpmyadmin. This is also certainly not in the SuExec path, so I assume I won't get any suexec problems from that. I recompiled my own SuExec yesterday to use /var/www instead of /home and to use httpdocs instead of public_html.

Sun, 06/21/2009 - 11:38
Joe
Joe's picture

System-wide phpmyadmin works fine, but it's definitely easiest to put in on one domain rather than all of them. I don't know anything about the Ubuntu package of it, though...

I can mention a few things that might help point you in the right direction on using it.

Suexec will never run anything that has been installed from the Ubuntu repos, because ownership will be wrong. So, if you're using stuff installed via that method, you need to accommodate by giving it a non-suexec execution environment. This could be a separate virtual host just for running this app (phpmyadmin.yourdomain.tld), or it could just be a different directory configured with Suexec disabled (yourdomain.tld/phpmyadmin).

You might find some configuration tucked away in the Apache config directory for the application, but it probably won't work the way it looks like it works (because the VirtualHost stuff is overriding it..."default" doesn't mean what you might think when Apache is configured in a virtual hosting environment). So, you probably need to be very explicit and specific about where you want it to appear.

Most folks who setup a phpmyadmin for all users do so on a standard domain (like the name of their hosting company), and they do so using the Install Scripts version of phpmyadmin. But, it could be setup to run on all addresses from a standard location (but, again, suexec is going to fight you, so you'll have to setup a path or virtual host that is not subject to suexec).

--

Check out the forum guidelines!

Fri, 06/26/2009 - 12:16
mrwilder

I just installed phpMyAdmin in usr/share, edited php.config.ini to use http based authenticaion, and added the alias

/php ---> /usr/share/phpmyadmin/

in Webmin's control panel for the Apache default server Aliases and Redirects setting as "Document directory alias".

It works fine on two of my boxes.

Sat, 09/04/2010 - 19:04 (Reply to #5)
magicool

Hello, I set phpmyadmin like you did. Phmmyadmin is now accessible via anydomain.com/phpmyadmin. I also added in the phpmyadmin directory a .htaccess to redirect http to https. The problem is that I have no clue on how to make it work under https. Any help is much apreciated.

Sat, 09/04/2010 - 21:03 (Reply to #6)
mrwilder

Ok... if you have http://anydomain.com/phpmyadmin working, what happens when you go to https://anydomain.com/phpmyadmin?

Sun, 09/05/2010 - 17:38 (Reply to #7)
magicool

Hello, When I access https://anydomain.com/phpmyadmin I get in IE "Internet Explorer cannot display the webpage" and in FF "Secure Connection Failed. An error occurred during a connection to anydomain.com. SSL received a record that exceeded the maximum permissible length. (Error code: ssl_error_rx_record_too_long)" The Apache error.log says: "Invalid method in request \x16\x03\x01"

Things I did from the start: I installed phpmyadmin in /usr/share/phpmyadmin/ Under Webmin-Servers-Apache Webserver-Default Server-Aliases and Redirects-Document directory aliases I set From: /phpmyadmin TO /usr/share/phpmyadmin/ I'm sure I missed some steps to enable access to phpmyadmin via https.

Update: Now I enabled SSL for one Virtual Server and it seems that I can conect to phpmyadmin via https from anydomain/phpmyadmin. The problem is that all the other virtual servers have acces to ssl now (I do not mean phpmyadmin; all the domains are accesible via http and https). What did I do wrong?

Mon, 08/08/2011 - 07:58 (Reply to #8)
hoekie

I found this: "Name-based virtual hosting cannot be used with SSL secure servers because of the nature of the SSL protocol." and http://wiki.apache.org/httpd/NameBasedSSLVHosts basically says all ssl requests for one IP go to one virtualhost configuration.

Try to configure at least one IP for SSL connections only and keep other domains on other IPs. Alternatively you can use RewriteRules to redirect all non-ssl domain back to their http://www.domain.com/ .

RewriteCond %{HTTP_HOST} !^my-ssl-domain.com$ RewriteRule .* http://%{HTTP_HOST}/ [R,L]

Mon, 09/13/2010 - 17:58
luis.sanchez.herrera

I was looking this solution for the last five days and now I got it!

Well, you have to follow the next steps to set up PhpMyAdmin (Web Based MySQL Admin Tool) and PhpPgAdmin (Web Based PostgreSQL Admin Tool) with all your virtual servers:

INSTALLATION OF PHPMYADMIN

1) If you want to install PhpMyAdmin from YUM's repository, you can check this page (http://wiki.mediatemple.net/w/Install_ISPConfig_on_CentOS_5.5), look for "Install Apache, MySQL, phpMyAdmin"
2) Edit /etc/httpd/conf.d/phpmyadmin.conf
3) Change internal "Aliases" in phpmyadmin.conf and save it
4) Restart Apache (/etc/init.d/httpd restart)

INSTALLATION OF PHPPGADMIN

1) Download PhpPgAdmin from its website and uncompress it into /usr/share/phppgadmin
2) Create phppgadmin.conf from phpmyadmin.conf with the following command:

cp /etc/httpd/conf.d/phpmyadmin.conf /etc/httpd/conf.d/phppgadmin.conf

3) Change internal "Aliases" in phppgadmin.conf and save it
4) Restart Apache (/etc/init.d/httpd restart)

SETTING UP VIRTUALMIN CONFIGURATION

1) Log in to Virtualmin
2) Go to the "System Settings"
3) Go to the "Server Templates"
4) Select "Default Settings" template
5) In "Edit template section" select "Apache Website" and click "Change" button
6) Go to the "Default PHP execution mode" option
7) Select "Apache mod_php (run as Apache's user)"
8) Click in "Save" button

After do this 8 steps, you can create new Virtual Servers and your http://www.newvirtualserver.tld/phpmyadmin and http://www.newvirtualserver.tld/phppgadmin will be ready to function!

Everything explained here works for me!

Kind regards and good luck!

Sat, 10/23/2010 - 07:22 (Reply to #10)
yngens

What if I need to run PHP in FCGId mode?

Tue, 12/28/2010 - 17:45 (Reply to #11)
adrianmak

This setup work for mod_php only. How about on php fastcgi mode ?

Fri, 12/31/2010 - 05:14 (Reply to #12)
iconeb

Assuming you have a shared phpmyadmin installation (maybe coming from an rpm package), just add at the bottom of your web server template:

<Location /phpmyadmin>
Options -Indexes +IncludesNOEXEC +FollowSymLinks
allow from all
AddHandler php5-script .php
AddType text/html .php
</Location>

Do not forget to change your phpmyadmin global configuration auth to sess or http, and enable it through https.

Thu, 04/11/2013 - 23:11 (Reply to #13)
yngens

Doesn't work with "Options +SymLinksIfOwnerMatch".

Sat, 11/28/2015 - 15:17
masterg0g0

This is one aspect, which is difficult to manage.. if there was a way to install all central for databases, mail server, etc.. and then with any new virtual server.. you could point to them centrally.. that would have been a such a good feature..

Best Regards, Rohit
www.interstellarconsulting.com

Topic locked