Hi
I am reading this post on the Virtualmin site:
http://www.virtualmin.com/node/8648
That sounds just what I want to do.
If I understand it correctly I will then only need to install phpmyadmin once to the 1st Virtual Server that I created.
This part specifically is what I am keying in to:
"I did indeed make root.com a Virtual Server -- and I setup phpMyAdmin within it (amongst some others).
But no other domains are sub-servers of it.
So, let's say I go to create a new Virtual Server (test.com) -- I set it up to create a DNS CNAME for phpmyadmin.test.com (which I configured in the DNS Server Template).
At that point, if I were to browse to phpmyadmin.test.com, since it's not currently aliased to any Virtual Host, I'd end up viewing the default Virtual Host, which I setup to be root.com (to make it the default, it just has to be the first Virtual Host listed in the Apache config).
Then, I edited the Apache Virtual Host config for root.com, and added this:
RewriteCond %{HTTP_HOST} ^phpmyadmin..$ [NC] RewriteRule ^(.) https://root.com/phpmyadmin/
That says that anytime a URL beginning with "phpmyadmin." is seen, to redirect to "https://root.com/phpmyadmin".
And that's it -- now, anytime a new Virtual Server is added -- it creates a DNS CNAME for phpmyadmin, and whenever they go to it, it redirects to the central phpMyAdmin install in root.com. -Eric"
I am not following you here:
"which I configured in the DNS Server Template"
( FYI - I still only have the 1st Virtual Server Setup. I want to get all the stuff setup the way it should be before I starting adding additional virtual servers)
Does that mean I go to "Server Configuration" "Dns Records" and add a CName
or does that mean I go to "System Settings" - "Server Templates" - "Default Settings" and put the cname in "Bind DNS domain"? Perhaps in the "Bind DNS Records for new domain"?
Can you tell me the format to enter it if this is done manually?
I assume this is something you would do if you are managing the server yourself like I am?
Was curious if doing this will then give access to all the databases on the server?
Also - do I need to purchase a SSL cert if I am the only admin on the machine? That is - dont care if its self-signed. If it matters I will purchase one.
Comments
Submitted by andreychek on Wed, 10/12/2011 - 15:44 Comment #1
If I understand it correctly I will then only need to install phpmyadmin once to the 1st Virtual Server that I created.
You can indeed use one phpMyAdmin installation for all the domains on your server. Any user can log into that one phpMyAdmin installation.
I assume this is something you would do if you are managing the server yourself like I am?
Well, if I were setting up a web hosting site for all of my customers, I'd probably keep things simple and offer one landing page that has links to all the pages of interest.
So, if my web hosting was named "Example Hosting Inc", and I had a domain "example.com", I'd offer a set of links that were interesting to all my users at example.com/members/ or something like that.
And then, I'd put phpMyAdmin at "http://example.com/phpMyAdmin" -- and have a link to that in the above mentioned landing page.
Also, I'd go into System Settings -> Server Templates -> Default -> Mail for Domain, and I'd set the initial email that goes out to new customers to contain all those links as well.
In my experience, users rarely remember URL's, they usually look them up each time, or they bookmark them. So, going through the hassle of setting up a alias for phpMyAdmin may not be worth it :-) Having all the links both in their signup email, as well as on a single landing page, is a great way to get them the information they need.
Submitted by PCS on Wed, 10/12/2011 - 16:28 Comment #2
Hi Eric
I have setup Virtualmin for domains that only I will manage. Nobody else logging in.
And I believe I understand you.
That is - I can setup phpmyadmin under one virtual server.
Its not automatically installed for a virtual server so unless I install it again that will be my only instance.
Would I still do this:
Edit the Apache Virtual Host config for root.com, and add this:
RewriteCond %{HTTP_HOST} ^phpmyadmin..$ [NC] RewriteRule ^(.) https://root.com/phpmyadmin/
That way I don't accidentally login via port 80 ?
.
If for some reason I did want someone to manage their own virtual server in that case I would need to install phpmyadmin for that server otherwise they would see all the other databases. Correct?
Submitted by andreychek on Wed, 10/12/2011 - 20:26 Comment #3
That is - I can setup phpmyadmin under one virtual server.
Its not automatically installed for a virtual server so unless I install it again that will be my only instance.
Yup! That sounds correct.
If for some reason I did want someone to manage their own virtual server in that case I would need to install phpmyadmin for that server otherwise they would see all the other databases. Correct?
Incorrect... any user in any domain can securely use phpMyAdmin.
The user that logs in receives access to their own databases, and no others.
So even with other users, you can still have just one instance of phpMyAdmin.
That way I don't accidentally login via port 80 ?
Well, what you pasted in there is specific to how things were done in that forum post, that won't work as-is for you.
However, a simple way to do that would be to put a file named .htaccess into your phpmyadmin directory, and put the following into it:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
You'd of course put your own domain in there in place of "www.example.com".