Subdomain linked to IP-less virtual account?

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
bbf
Forum Newbie
Posts: 1
Joined: Wed Apr 30, 2008 10:11 pm

Subdomain linked to IP-less virtual account?

Post by bbf »

Hi, this is the first time I play with subdomains via DNS so I'm a little confused. I've got a reseller account so I can create unlimited virtual accounts. I've only got 1 IP (but I can get more if that's what will get this to work).

I want:
domain.com -> domain.com virtual account
sub.domain.com -> completely separate virtual account on same IP

Is this possible?

I've added the A record to the DNS so that sub.domain.com points to the correct IP. Problem is that once it forwards to that IP, it doesn't find the virtual server. I've created a virtual server with the domain "sub.domain.com" but it doesn't see it (I get a "server not found" error).

What am I missing?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Subdomain linked to IP-less virtual account?

Post by pickle »

Not sure what distro you're using, but I just set up a virtual host on my Fedora box using a virtual host.

There is a directive in httpd.conf to enable name based virtual hosting - make sure that's enabled.

Make a virtual host entry for the subdomain - it should be just like the main domain, just with a different server root & server name (and possibly server admin). httpd.conf should have an example in it.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: Subdomain linked to IP-less virtual account?

Post by Jenk »

Example httpd.conf:

Code: Select all

NamedVirtualhost *:80
 
<VirtualHost *:80>
  ServerName http://www.example.com
  DocumentRoot /some/path/
</VirtualHost>
 
<VirtualHost *:80>
  ServerName http://subdomain.example2.com
  DocumentRoot /some/other/path/
</VirtualHost>
Post Reply