Dark Light

My small server currently hosts a number of websites. Too many, really, I should get a bigger server. However, I long ago got bored of creating separate site files for every website I host, so I use MassVHost to make that go away. The same file runs on my dev servers, and it means that to create a new domain all I do is point DNS at it (via hosts, wildcard or whatever) and create a directory with the same name as the site. So, for example, I create /var/www/hosts/unhelpfulclue.aqxs.net/htdocs and http://unhelpfulclue.aqxs.net/ automatically points there.

This is what that looks like:

(That file is in /etc/apache2/sites-available as “vhosting”, then enabled with a2ensite. This is all under Debian. You’ll also need the vhosting module installed, enabled and working. )

One of the most common things you also need to do is automatically redirect people who go to “www.domain.tld” to “domain.tld” or vice versa depending on your religion. In this world, the canonical name of the site is whatever the directory is called. The thing with the 404 errors and the EverythingIsCatchingOnFire (Spot the reference for five points) stuff means that by default 404s go to this script, which in the event of a “This domain doesn’t exist”, it looks for an appropriate domain and sends you there:

(Meaning not only does http://piracyinc.com/ go to the right place, but http://www.piracyinc.info/ does too)

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts