1

After years of using managed servers I'm finally getting my feet wet with setting up a webserver (using rackspace cloud). Here is how I have things setup:

Server A (hosted with servint.com, manages DNS for example.com) Server B (rackspace cloud server, I want to serve apps for example.com from here)

I've added an A record on Server A for app.example.com to point to Server B's ip address. This works great! Now I also have phpMyAdmin installed on Server B. If I go to Server B's phpmyadmin URL like "XX.XX.XX.XX/phpmyadmin", it loads just fine. What I would like to do is configure another A record on Server A like "phpadmin.example.com" which will point to Server B. I have not yet set up a VirtualHost for that server name, so I get the default sites-enabled.

How do I tell apache that "phpadmin.example.com" should load "phpadmin.example.com/phpmyadmin"? A job for mod rewrite? Something in the default virtual host?

Any help is much appreciated!

1 Answer 1

2

Once you have setup the apache virtual server, just make the directory it forwards to the directory phpMyAdmin lives in.

General Apache Virtual Server Config:

DocumentRoot "/usr/share/phpmyadmin"
ServerName phpmyadmin.example.tld
<Directory "/usr/share/phpmyadmin">
allow from all
Options +Indexes
</Directory>

Hope this helps and DFTBA. :)

3
  • 1
    As a note, with this configuration, all you would need to do is visit phpmyadmin.example.tld and it would load phpmyadmin. You may want to configure htdigest authentication to give two layers of password checking. Or change the allow from all, to only allow ips you come from, and deny all others. Jun 7, 2012 at 18:00
  • 1
    Indeed; since phpMyAdmin allows access to well, databases; securing them is a must. As a side note; make sure to also remove MySQL access to the outside world if you only have the single server doing the tasks. This can be achieved w/ IPTables.
    – Jason S
    Jun 7, 2012 at 18:04
  • Thanks for the input! I'm going to give this a shot when I get off work :) For some reason I didn't think I would need another virtual host, but now I don't know why I was thinking that. Maybe because it was 2 am... I did set up iptables in accordance with this video (youtube.com/watch?v=JZepJ2Vx5-U), so I think I'm good there? (found out about UFW later on). Agree about the extra security, I'll enable that as well. On a side note, I actually had to look up DFTBA and can say, I NEVER DO.
    – Greg
    Jun 7, 2012 at 20:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .