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
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
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?
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.
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.
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.