How can I create a custom TLD (for an Intranet) on my Wi-Fi network with a Windows computer and Apache?

Posted on

How can I create a custom TLD (for an Intranet) on my Wi-Fi network with a Windows computer and Apache? – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about apache-2.2, networking, router, intranet, tld.

Can you please explain to me how I would do this, starting with the installation of Apache?

Are there multiple ways to do this? I would like the domain (eg http://intranet) available when you connect to the network, without editing the hosts file on every computer. Is that possible?

I would also like to create subdomains for my local URLs (eg http://site.intranet); can you tell me how to do this in Apache, and how to configure it?

Would I have to rename my computer to intranet, or is there another way to map the domain without editing each computer’s configuration or workgroup (possibly through my router’s settings)?

I would be very grateful if you could help me understand my options better, and tell me how to set up the server; thank you!

Solution :

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!

The technology you are after is name-based virtual hosting. You would typically configure your DNS server with an A or CNAME record that for each domain/subdomain that you want to serve that points to the address of your apache server.

You then use name-based virtual hosting to configure a vhost for each domain/subdomain.

Take a look at http://www.opennicproject.org they specialize in custom TLDs. They have a lot of information about setting them up and all their domains are free to use. My favorite is .geek lol then .pirate 😛

You could also apply for a TLD now if you’re a millionaire. Since I’m not it’s open nic for me.

Leave a Reply

Your email address will not be published. Required fields are marked *