Link to home
Start Free TrialLog in
Avatar of baxleyb
baxleyb

asked on

How to create subdomains and NOT use DNS

Hi,

I would like to be able to create subdomains on our Apache 2 webserver.

I DO NOT want to add these sub domains to our DNS (currently using third party website).

EXAMPLE:

mydomain.com <- All requests go here

sub.mydomain <- All requests go to root document for this subdomain WITHOUT using DNS

Here is my current configuration but only works with DNS etries:


NameVirtualHost 1.2.3.4
<VirtualHost 1.2.3.4>
ServerAdmin webmaster@mydomain.com
DocumentRoot /root/subdir
DirectoryIndex index.html index.htm index.php index.cgi
ServerName sub.mydomain.com
ErrorLog /var/log/httpd/subdir/error_log
CustomLog /var/log/httpd/subdir/access_log custom env=!object
</VirtualHost>

I hope this question makes sense and I hope this is possible.

Thanks,

BB
ASKER CERTIFIED SOLUTION
Avatar of caterham_www
caterham_www
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of periwinkle
caterham_www is correct - in order for a webpage of a subdomain to be resolved, you need both a dns entry that covers that subdomain, and an apache configuration that covers this domain as well.

If you do not want to specify out each subdomain, you need a wildcard entry like he has specified, as well as some form of default virtualhost configuration, that will pick up the subdomains.
HI,

also as you said

I DO NOT want to add these sub domains to our DNS (currently using third party website).
======== Than ofcourse you can add your subdomains entry in some remote DNS server that resolve to your apache. It is not necessary to have DNS server on same server. But the DNS server name you add your subdomians must be one of the nameserver define for that Domain...

i.e. if you domain is hosted on your server with nameserver as ns1.domain.com and ns2.GenericNameserver.com
and ns1.domain.com is on your server but ns2.GenericNameserver.com belongs to some other server of some hosting company. Than just add your sub-domain DNS entry in there server, and put virtual tag in your apache.

DNS server are to resolve the name to IP once it is done either by your server or by remote it doesn't matter to a request they will get your subdomains IP thats all they need

But for simplicity follow what has been said above ...

Though I am interested to know why you need to do that, if you have a subdomain register it in DNS why you don't want will be interesting...

VIkasumit
Avatar of baxleyb
baxleyb

ASKER

periwinkle,  caterham_www,

Thanks for your posts. We are currently using DNS to resolve sub-domains but would like the flexibility to NOT use DNS to accomplish this.

So if I did use a wildcard then would EVERY sub domain attempt to resolve to one ip address?

What if I had like 5 that should go to different ip addresses? How would that work?

EXAMPLE:

anotherserver.mydomain.com -> 1.2.3.4

anotherserver.mydomain.com -> 1.1.1.1

*.mydomain.com -> 2.2.2.2

anotherserver.mydomain.com -> 3.3.3.3

Thanks,

BB

 
Avatar of baxleyb

ASKER

Well I found out that I can use a wildcard, but it has been decided to do this at a later time, for now we'll stick with direct to DNS.

caterham_www, thanks for your advice and response.

Best,

BB