PDA

View Full Version : subdomain pointing to a hostdomain



sunzon
02-24-2005, 11:38 AM
I assume others have had this need, so a simple question:

maindomain.com (has an IP address, DNS enabled)
hostdomain1.com (no IP address of course, installed at /var/www/hosts/hostdomain1/, cgi-bin at /var/www/hosts/hostdomain1/cgi-bin/)

DNS has not yet been enabled for hostdomain1.com which is being moved to WH from elsewhere, before doing so I want to be able to test scripts to ensure everything is working first. That is not possible without an IP address.

So I figured the way to do this is create a temporary subdomain on maindomain.com like this:
h1.maindomain.com
with path to /var/www/hosts/hostdomain1/

Then I can go to http://h1.maindomain.com to test hostdomain1.com as installed at WH.
But that doesn't seem to work.
I also tried h1.whsites.net, that doesn't help either.

Clearly doing something stupid here, can anyone provide a quick howto?
thanks

jalal
02-24-2005, 12:49 PM
What is that "doesn't seem to work"? Accessing the sub-domain or testing the scripts? Is it a server error or a page not found sort of thingy?

wildjokerdesign
02-24-2005, 01:38 PM
I have had to wait a bit sometimes for a subdomain to "take hold". Is it working now?

sunzon
02-24-2005, 03:59 PM
Thanks guys.

(sorry Jalal, should have indicated the error: page not found)

You were right WildJokerDesign.
I hadn't thought of that at all, it just needed a time delay for it to work!
I tried again just now and it works fine.
8)

sunzon
02-24-2005, 05:56 PM
I spoke too soon (arggh...).

Surprisingly (for me anyway) I can't go to a subdir at h1.maindomain.com, only access pages at hostdomain1 level.
That defeats my purpose, I need to go to the cgi-bin of hostdomain1 to run tests.
I tried adding an alias /cgi-bin/ under h1.maindomain.com to /var/www/hosts/hostdomain1/cgi-bin/ but that doesn't help.
(on that last point I had misgivings, fearing it might disrupt the maindomain, I tried a cgi-bin access on maindomain and it 404'd, but since my ISP connection was temporarily shaky/weak, I though it may be that. since i couldn't access even a subdir anyway i quickly removed it.)

I get a 404 error.

Mission impossible, or is my approach wrong?
thanks for ideas............

wildjokerdesign
02-24-2005, 06:37 PM
Instead of an subdomain why not a simple alias of /hostdomain1/ pathed to /var/www/hosts/hostdomain1/ so that you can access it like this http://maindomain.co/hostdomain1/.

Did that make sense?

sunzon
02-24-2005, 08:03 PM
Thanks....
Tried it, got a 404.
Of course there is no "http://maindomain.com/hostdomain1/".
If I created that subdir under maindomain, guess I could just as well make a symlink from there then anyway.
It's another approach, indeed. Good idea.

Surely my situation need is not very unique, others must have been thru this. The temporary canonical name just seemed the way to go.

I can always gamble all will work anyway, and probably it will, or resolve anything when DNS is live, but I hate to have a site down and I bet it happens just when I can't take no more and want to go to bed........

Another day, the same situation will arise, I would just like to have a formula tucked under my sleeve to cope with that.
Moving servers is a new experience and requires new knowhow.

wildjokerdesign
02-24-2005, 09:08 PM
Odd it seems like that should work... have to give it some more thought. If I come up with anything I'll let you know.

jalal
02-25-2005, 01:19 AM
I have sub-domains on my site and they work just fine. For instance, codeworks.gnomedia.com is a sub of the main site, with its own cgi-bin and works just fine.

In fact, I can just create a sub-domain on any site and there is no need for any DNS updates (sub-domains are not part of DNS), as long as the directory it points to exists it 'just seems to work'.

So, I'm puzzled as to why you have a problem.
Maybe take it in stages:

Assume you have 'domain.com' and that it works.
1. In site manager, create 'test.domain.com', point it to /var/www/test.
2. Put an index.html file in there.
3. Now, pointing your browser at 'test.domain.com' should just call up the page you added. No need for DNS propogation on this.

If that doesn't work, then you maybe need to contact WH, as there is something basic wrong with your site setup.

If that does work, then we just need to sort out the cgi-bin, and then the question is, do you really need a separate cgi-bin directory or can you just use the one that you have?

HTH

sunzon
02-25-2005, 07:13 AM
Thanks Jalal.
I am aware subdomains are not part of DNS.
That's not the issue.
The time delay mentioned was not DNS propagation, but WH install-to-take-effect delay.

Using your terminology, yes, the page comes up for test.domain.com.
See in above postings.

In your case for codeworks.gnomedia.com, I note there exists a gnomedia.com and a codeworks.com, but I can't tell if codeworks is an installed hostdomain of gnomedia.com. That would make the issue identical to mine, and you could tell me if you made any further aliases.

I agree with you that logically my scenario should work, I will investigate for some possible stupid error since everyone says it should work.
I'll report back.

sunzon
02-25-2005, 08:34 AM
Problem is solved.

Works as planned according my original post.

There was an old modrewrite copied from the previous provider that caused havoc, that was a stupid error I was blind to. Sorry for wasting your time because of that bit :oops:

The other issue was not realizing I had to have another cgi-bin alias for that h1.maindomain.com, that got it working (the bit I had misgivings about at first). WJD had already warned me about that issue which I didn't fully comprehend.

thanks for all your willing help.
I'm on my way again.......... :P

jalal
02-25-2005, 08:38 AM
Ah, possibly I have misunderstood the situation. I thought you were having problems setting up a sub-domain. My mistake.

As for the time delay, I have never noticed that before. Adding a sub-domain via Site Manager is essentially the same as editing your httpd.conf file and restarting apache, i.e. no delay at all.

sunzon
02-25-2005, 08:59 AM
You have a point Jalal.

Actually I'd be more comfortable editing httpd as I did at a previous provider, it's a learning curve for me to work with a panel interface.
But since httpd has some different looks to it presumably because of the specific VPS environment at WH, I figure I have to just learn to adapt. With more installations I will be able to see what happens in httpd. Different providers have different setups and methods.