Posts Tagged ‘Domain’

Adding a Custom Error Page when Hosting Multiple Sites Using Apache

Another optional extra you might want to consider when hosting multiple sites, or just when working with subdomains, is a custom error page.

Using the more basic configurations detailed in previous tutorials, you may occasionally find odd results being returned to your clients. For example, if someone were to simply type your server’s IP into their browser, or spelled a subdomain incorrectly, Apache2 will serve them up the first site it finds in its configuration path. If you’re hosting multiple sites, this means that a totally different site might be returned, which doesn’t exactly look professional.

Here, I’ll show you how to easily counter this problem, by creating a custom error page for your server.

[If you’re not familiar with Apache configuration files, read one of the tutorials linked above for more info.]

Step One

Create your custom error page and save it as ‘index.html’. In this example, we’re going to create the ‘index.html’ file at /home/randymarsh/errorpage/index.html.

This page could just be an image or some text, or you can write a redirect to one of your hosted sites or their subdomains. As long as it’s called ‘index.html’, you can do what you want here.


Creating Subdomains With Apache 2

In my last post we covered how to host multiple websites from the same server. This is really useful if you have several domains or are hosting websites for others and don’t want to invest in multiple lines and more hardware, but what if you just wanted to create a subdomain for a site you already own?

For example, if your main site was located at ‘’ and you wanted to add a blog, but didn’t want to move away from your domain to access it, you can add a subdomain – ‘’, for example – at which it can be read.

This is an extension of the longer post about multiple site hosting, so if any parts are not explained, please read the previous entry linked above for a better understanding.

It’s a pretty simple process which can make a single-domain site much more flexible.


Hosting Multiple Sites on the Same Server Using Apache2

When I upgraded to my new server (Lumpy Gravy) and migrated my own site from my trusty HP DL380 to the new box, I took the opportunity to get better acquainted with one of the cornerstones on the internet, a piece of software you rarely ‘see’ but operates behind the scenes not just of this site but a full 59% of the entire internet – the Apache web server.

Apache2 comes as part of the ‘LAMP’ packages you are given the option to install when loading Ubuntu Server, and by forwarding port 80 to your machine you can start hosting web content quickly and easily.

But what if you wanted to host multiple websites from the same server? This is something I’ve had to do for the first time this week, and it’s all possible with a few simple configuration changes to Apache.