It all hinges on DNS. You have to make sure that the DNS name intranet
gets resolved to an IP address. I know how to do this only one way: installing my own DHCP and DNS service for the infrastructure. Bonjour-style should work as well, but I have no experience doing it that way.
The operating systems I know of support DNS suffixes, like .local
or example.corp
. You'll control the DHCP server on your network, correct? Lets assume it will give out addresses like 192.168.13.128
, with a 255.255.255.0
network mask and most importantly, it will give out the address of a DNS server that knows how to answer authoritatively over the example.corp
zone and it will say to the DHCP clients that their DNS domain is example.corp
. Most operating systems will then try to access http://intranet.example.corp
if you type http://intranet
.
This is how the short-names will work. Onwards to name-based virtual-hosting, like @Iain said. Let's assume your Apache's configuration says:
Listen *:80
NameVirtualHost *:80
I'll assume the Apache server has the 192.168.13.1/24
IP address. I'd put an A
record like s01.srv.example.corp.
pointing at 192.168.13.1
and a CNAME
like intranet.example.corp.
pointing at s01.srv.example.corp.
and if you need sub-sites I'd put in site.intranet.example.corp.
as well, pointing at the full s01.srv
DNS name.
Back to the Apache configuration: you'll need to add virtual-hosts like these:
# this matches the NameVirtualHost directive and
# loosely matches the Listen directive; it could also be:
# NameVirtualHost 192.168.13.1:80 and you'd change this below as well
<VirtualHost *:80>
# notice you'll need both of these;
# they must match what's in the browser Location bar
ServerName intranet.example.corp
ServerAlias intranet
# sorry for the Unix-style paths, I avoid Windows a bit
DocumentRoot /var/www/intranet.example.corp
</VirtualHost>
I don't mind expanding on this, if you need help. Please feel free to ask!