Dns & Apache Vhosts

Trying to set up apache virtual hosting on a fresh install of suse 11, and though everything appears to point to dns and the vhosts being set up ok, something isn’t right

/usr/sbin/httpd2 -S returns:

VirtualHost configuration:
wildcard NameVirtualHosts and default servers:
*:80 is a NameVirtualHost
default server mystuff.co.uk (/etc/apache2/vhosts.d/aa.conf:1)
port 80 namevhost mystuff.co.uk (/etc/apache2/vhosts.d/aa.conf:1)
port 80 namevhost test.mystuff.co.uk (/etc/apache2/vhosts.d/test.conf:1)

I’m assuming that indicates the files in vhosts.d are defined ok

On the dns side if I do:

dig @192.168.0.2 MachinesHost.mystuff.co.uk and

dig @192.168.0.2 test.mystuff.co.uk

They both come back with the expected results

Although if I do dig @192.168.0.2 mystuff.co.uk I only get

MachinesHost.mystuff.co.uk. and root.MachinesHost.mystuff.co.uk in the authority section, I’m not sure whether the test one should appear there or not

If I open MachinesHost.mystuff.co.uk in a browser I get the page I’ve placed in the main domain’s documentroot, but the test.mystuff.co.uk in a browser reports an unknown host error

(I have a domain that normally points to my external ip but I’ve recently changed isps and the domain forwarding hasn’t propogated yet to the new ip so I don’t yet know what happens if I just put mystuff.co.uk in a browser)

I’ve tried defining the test subdomain as both a cname to the machine’s hostname and also as an A record to the local ip in dns, same result

Any suggestions on where I’ve gone wrong appreciated

I’m not sure whether I didn’t word the question very well, whether the question was totally stupid, or just that no-one has any ideas

You do these queries on the DNS server:


dig @192.168.0.2 MachinesHost.mystuff.co.uk and

dig @192.168.0.2 test.mystuff.co.uk

but is 192.168.0.2 specified as the only nameserver and forwarder for the machine with the browser? If you have another nameserver in /etc/resolv.conf then none of what you expect will work.

Apologies for appearing to disappear, medical crisis in the family

ken_yap I was trying to open them on the machine the server(s) run on

Other machines on the lan can open the pages if as you say they’re using the 192.168.0.2 as their nameserver

What doesn’t work though is any machines outside of the lan being able to open them, they can open the main mystuff.co.uk, but not any of the subdomains

The firewall isn’t blocking either http or dns, and the router is forwarding both http and dns to 192.168.0.2

Is there some other step I need to carry out in order for external clients to open them?

It’s like I’m almost there but not quite

Why would they? You have not made your domain names visible in the global DNS system. Just running a nameserver on your LAN, or even opening up access to it from the outside is not sufficient to make those domain names visible to the Internet. You have to register the domain mystuff.co.uk, and arrange for names in that domain to be resolved by nameservers that are connected up to the DNS infrastructure. The most straightforward way to do this is to pay a domain registrar, who usually also runs nameservers, to register your domain names.

I am using an actual registered domain, obviously mystuff.co.uk was just an example name I used, but the domain I’m really using does point to here

I assumed that subdomains to it would also be handled by their servers, guess I need to speak to them about it

Thanks for the fast response there though ken_yap

You would have to enter any subdomain names at your registrar’s nameserver also. Usually they provide some kind of web interface where you can edit away.

Yeah mate, I’ve just found a web form on there for adding nameservers, hadn’t spotted it before with it being in an obscure corner of the site

I’m trying one now though I expect it’ll take a while to propogate

Be aware that often the roles of registrar and nameservers can be split.

A registrar takes your money for claiming the base domain for you. They may or may not run nameservers as well. Often they do and you pay for both services. If they don’t you can elect to have another party run your nameservers.

But if you are savvy, and you have a good fixed IP connection, you can run your own nameservers. Naturally, being a service, it has to be kept secure (recall the recent Net-wide alert to update nameserver software). Organisations with sufficient IT expertise register their domain with the parent domain, and then run their own nameservers. They need that kind of control over their subdomains.