I have my own webserver on a 1 Megabit line, at the moment I have 2 websites, and use Apache 2.
Manuals seem to make things complicated os here's a siomple guide on how to do it.
First of all you'll need to edit the httpd.conf file, this can be found in your Apache directory, and then in the conf subdirectory, sor example this is where mine is:
The file is well commented, anything that has a # before it is a comment, so you can comment lines out you don't need or add comments to help you.
The area of the file we will be looking at, is usually at the very bottom of the file, Section 3: Virtual Hosts.
# # Use name-based virtual hosting. # #NameVirtualHost * # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # #<VirtualHost *> # ServerAdmin firstname.lastname@example.org # DocumentRoot /www/docs/dummy-host.example.com # ServerName dummy-host.example.com # ErrorLog logs/dummy-host.example.com-error_log # CustomLog logs/dummy-host.example.com-access_log common #</VirtualHost>
The above is the sample VirtualHost out of the httpd.conf file, the entire thing is commented out, as from this server VirtualHosts are not been used.
For each site you want to setup you have to create a VirtualHost, the first virtual host is the default, e.g if i do, http://188.8.131.52 that is not specifying a website, so the default one is displayed, which in my case is www.whittnet.co.uk.
Something i have noticed is, you have to create two, entries for one site, one for http://www.coolchip-computers.co.uk/ and one for http://coolchip-computers.co.uk.
This is because if you don't have an entry for the one without the www, it will show the default site, as it has no record of just coolchip-computers.co.uk.
For every VirtualHost you need to put the information within a Virtaul host tag, <VirtualHost *> options goes here </VirtualHost>.
The most common options are:
ServerAdmin #AdminsEmailAddress DocumentRoot #DocumentRoot e.g c:apachehtdocsdomain1 ServerName #servers FullyQualifiedDomainName e.g www.whittnet.co.ukExample:
<VirtualHost *> ServerAdmin email@example.com DocumentRoot e:htdocswhittnet ServerName www.whittnet.co.uk </VirtualHost>
Int the above notice i did, www. So i'd have to create another without the www, example:
<VirtualHost *> ServerAdmin firstname.lastname@example.org DocumentRoot e:htdocswhittnet ServerName whittnet.co.uk </VirtualHost>
To add another VirtualHost just follow the above.
Once you have edited the file you have to restart the Apache service, this can be done by using the apache control panel or by the services MMC snapin in your administrative tools.
The below example shows my VirtualHost setup:
<VirtualHost *> ServerAdmin email@example.com DocumentRoot e:htdocswhittnet ServerName whittnet.co.uk </VirtualHost> <VirtualHost *> ServerAdmin firstname.lastname@example.org DocumentRoot e:htdocswhittnet ServerName www.whittnet.co.uk </VirtualHost> <VirtualHost *> ServerAdmin email@example.com DocumentRoot e:htdocscoolchip-computers ServerName www.coolchip-computers.co.uk #RewriteEngine On #RewriteRule ^forum/(.*).html(.*)/$ /forum.php?forumID=$1 </VirtualHost> <VirtualHost *> ServerAdmin firstname.lastname@example.org DocumentRoot e:htdocscoolchip-computers ServerName coolchip-computers.co.uk #RewriteEngine On #RewriteRule ^forum/(.*).html(.*)/$ /forum.php?forumID=$1 </VirtualHost>
note in the above example the rewrite rules, rewrite rules can be applied to avirtual host, at the moment, i'm having some probs with mine so there commented out.
Hope this has been helpful.