Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

domain name problem w/ virtual hosting?

Status
Not open for further replies.

doublehelix

IS-IT--Management
May 15, 2001
50
US
I'm having trouble getting virtual hosts to work. I'm pretty certain I have them configured correctly, but still no luck...

Our domain is registered as rather than just somedomain.com, so that a virtual host would endup being virtualhost. (and that don't seem right to me).

Is that what is causing my problems?
 
It depends on how you have the <VirtualHost> directive set up -- by name or IP. I consider the latter the best way, and combine it with the ServerName and ServerAlias directives for a lot of flexibility. Following is an example.

<VirtualHost 127.0.0.1>
ServerName somedomain.com
ServerAlias etc..
</VirtualHost>

That way, Apache will respond to 127.0.0.1, somedomain.com and You can continue putting other aliases, space seperated on the ServerAlias line and you can also use wildcards such as *.somedomain.com to tell Apache to respond to all requests to the domain, no matter the subdomains -- although this will still be dictated by DNS.

Hope this helps,

brendanc@icehouse.net
 
Ooops, thanks for the answer, but I just realized I did a terrible job of explaining my self. Since is the name of my domain in DNS, when I alias it -- say to virtual -- my virtual domain then becomes virtual. and that doesn't work.

Should I rename my domain just somedomain.com? Or is there another way around my dilema.

BTW -- what the heck does that in the resololving of the host?
 
Back to the ServerName and ServerAlias directives then. e.g.

<VirtualHost 127.0.0.1>
ServerName ServerAlias virtual1.etc..
</VirtualHost>

or even:

<VirtualHost 127.0.0.1>
ServerName virtual1.etc..
</VirtualHost>


The &quot; is just common syntax. It's technically the same as any other subdomain like ftp.domain.com or mail.domain.com. Typically, DNS administrators use those subdomains to point the same domain to different machines running different services.

Hope this helps,

brendanc@icehouse.net
 
First off -- thanks for the help. I finally tracked the problem down. We don't control our local DNS server, it is housed offsite -- so there was a step I couldn't take.

Oh well, I'm trying to see if I can setup virtual hosts as ~ directories -- if not, we'll just have to bite the bullet and go through a ton of paperwork everytime we want to add a VH.
 
If the domain is registered, you actually own somedomain.com. is an alias. you should be able to set up aliases in virtualhost containers set to subdomain.somedomain.com.

<VirtualHost 192.168.0.23>
ServerName somedomain.com
ServerAlias </VirtualHost>
<VirtualHost 192.168.0.23>
ServerName somedomain.com
ServerAlias subdomain.somedomain.com
</VirtualHost>

Etc....
BTW: are you behind a firewall?
 
doublehelix,

Here's a thought. Just one, though! They don't come to often 'round my mind. ;-)

Assuming that you already have a working domain name for your main server, see if your host can CNAME (alias) the domain name with, say... NS0.domain.com and NS1.domain.com or something to that effect. Perhaps even give you new IPs (meaning they'd use A's instead of CNAME's.. DNS trivia) -- which would be ideal. If they can do this, install Bind ( on your server under this new alias. Register your own clients' domains and set the registered nameservers to your server.. that way, you have ultimate control (of course, if you're short on bandwidth, this can be a nightmare, too). With Apache, you can assign all virtualhosts to the same IP address using the NameVirtualHost directive, so you won't need to be constantly bothering your host and, again, you have complete control over how the domains and subdomains resolve.

So that's the thought... Good luck.

brendanc@icehouse.net
 
doublehelix,

I just re-read your message and interpreted it a bit differently than I did when I last posted. It sounds like you're a single entity spread out among different locations..? Thus, your domain name already has its own subdomain reflecting a DNS server .. that server is simply out of reach. Am I close? If so, you probably already thought what I posted above and I apologize for going on about something that is worthless to you.

However, I take that back for anyone else that reads this. The patent office wouldn't let me have the above technique, so as it stands now, *anyone* can set up a DNS server. Just keep up to date on security patches and learn it. Good thing for any up and coming sysadmin to know.

Hope this helps someone.

brendanc@icehouse.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top