How to host *only* a subdomain?


#1

Hi folks,

I have a domain (let’s call it foo.com) that’s not hosted on Dreamhost – I run both the DNS and the web server for it.

What I want to do is to host http://bar.foo.com/ on Dreamhost, without moving the rest of foo.com over. I also want to retain control over the DNS of foo.com – I was thinking I might make bar.foo.com a CNAME to apache2-ogle.thunderkittens.dreamhost.com, or delegate the entire bar.foo.com tree to Dreamhost’s nameservers, or something like that.

What I’m running into is, I can’t even add “bar.foo.com” as a domain, in Dreamhost. When I’m under “Manage Domains” and I click “Add new domain/subdomain”, fill in the details, and press “Fully host this domain”, it gives me an error: “You can’t add that domain: you don’t have permission to add to foo.com”. (well, the error includes my actual domain, not foo.com, but…).

What is it checking, to determine that I don’t have permission? Would it help if I added some DNS records to foo.com first, and then tried again later? If so, what DNS records should I add – the CNAME idea, or the delegation idea?

I found http://wiki.dreamhost.com/Using_a_Foreign_Nameserver but it didn’t seem to be making any clear suggestions on what to do.

Any thoughts?

Thanks!!


#2

Start by adding example.com, even though you’re not going to use it. Now you’ll be able to add sub.example.com

Now that you have sub.example.com, click on the DNS link next to it in the Manage Domains section. You’ll see the IP address assigned to that subdomain. Go back to your other DNS server where example.com is hosted and add an A record for the sub.example.com entry with the IP address shown here.


#3

Thanks – this worked!

I’m a little uncomfortable with just an A record – what if Dreamhost renumbers their machines? I did a reverse lookup and found that my subdomain is being hosted on apache2-zoo.thunderkittens.dreamhost.com – wouldn’t it be better if I made a CNAME to that, instead of an A record?

What would be really helpful is if Dreamhost could make a zone full of the right A records for everyone’s hosting, so that people who wanted to handle their own DNS could make, e.g. bar.foo.com be a CNAME to bar.foo.com.hosted.dreamhost.com. And then even if Dreamhost wanted to move bar.foo.com to a different server, or something, it would keep working.

Your suggestion did work, though, and I’m up and running. Thanks again!


#4

That’s actually a really good idea! I’ll look into what it’d take to get something like that set up.

There’s actually a way that you can fake this right now using a dreamhosters.com subdomain:
[list=1]
[] Set up the domain normally, with DNS not pointed to it.
[
] Create a dreamhosters.com subdomain that mirrors the real domain you’re trying to host. It doesn’t matter what it’s called, because nobody will ever see it.
[*] Set your real domain as a CNAME to the dreamhosters.com subdomain.
[/list]
Since the mirrored domain gets DNS generated for it identical to the “real” domain, this will get you the desired effect. But, like I said, I’ll look into how we can make this possible without the dreamhosters.com hackery. :slight_smile:


#5

!!! andrewf, thank you! I didn’t even know about dreamhosters.com, but now I do, and this is a perfect solution to my problem.

I added a domain to dreamhosters.com, set to mirror, as you suggested – the DNS hasn’t updated yet, but I’m confident that when it does, I’ll be able to add the CNAME on my end.

I’m going to feel a lot safer, this way.


#6

That’s the second biggest disadvantage of the dreamhosters.com workaround at the moment — the dreamhosters.com DNS zone is extremely large, so it can take a couple of hours to regenerate.

(The biggest disadvantage is simply that it’s not obvious!)


#7

I’ve looked into setting up automatic CNAMEs like you described, and unfortunately there’s no straightforward way to do it without doubling the size of our DNS database. Sorry. :frowning:

The dreamhosters.com workaround still works, though. For the time being, I’d recommend that as the best approach.


#8

The dreamhosters.com works very well and I found it easy to do work and it is safer way.


#9

Just out of curiosity, is it necessarily a good thing to reveal who is hosting a particular website? Try doing a Google search for “site:dreamhosters.com” and you’ll see all the users who have tried this dreamhosters.com hack. To be honest, I really don’t understand what it is or how it works, but it seems that suddenly I have a list of a lot of people who are clients of dreamhost…


#10

This should work for SVN too right? I’ve tried to set this up but for some reason I can’t get it to work.

I have added mydomain.com so I could add svn.mydomain.com to the “Manage Domains” panel. I have set up mysub.dreamhosters.com to mirror svn.mydomain.com. I have set up an SVN project using svn.mydomain.com/project. Finally, I have a CNAME that points svn.mydomain.com to mysub.dreamhosters.com.

Is there something I’m missing here? Thanks.


#11

That setup should work. If you tested it right after setting it up, though, you may need to wait a bit for DNS to catch up, as dreamhosters.com is a very large zone and can take a while to update.


#12

Well after half a day of failed attempts I finally figured out what the problem was. svn.example.com will not work as the text “svn” seems to be causing some kind of problem. I tried using subversion.example.com and this works fine. I switched between the two to confirm the issue and it does seem to be the case that “svn” was causing the problem. No idea why this should be the case however.