Virtual Hosts are great for servers, it allows you to have multiple domains, Subdomains and Users all use the same Web Host (Server) and Is easy to configure.
First Please make sure your server is configured to use Virtual Hosts, See Here , Please note this is fundamental
Now you have your domain on a Virtual host you can now add others, But you need to add your Host to your DNS zone file from your domain regestrar, See Here
Now you are ready browse to your Apache installation folder and go to httpd-vhosts.conf
Using Apache is Good, but for one website is limiting its potential you can create multiple websites, domains and sub-domains with Apache, see below.
First you need to stop your server, you can do this on lunix by entering [box type=”shadow”]
$ sudo /etc/init.d/apache2 stop
[/box]
into your terminal, this allows you to make changes to files in your server without breaking it, for windows you need to stop Apache using Xammp, see below.
This is the base of your web server, and probably where your Index.html is located, create two folders, Domains and Subdomains, this is where your domains will be stored. See below
In Domains, Place the dome of your website, replacing dots with hyphens like so
(Also add any other websites that you plan to host on the server)
Then copy the data that was in your root of the server into the domain folder on the server like this
then paste into your domain folder like this
So your Server should now have the ‘root’ of the server in
now you need to redirect traffic from your website to the correct folder, this is done with virtual Hosts’s, and is also how you add sub domains see below
browse to your Apache installation folder and go to httpd-vhosts.conf
and at the bottom add the following code replaceing my domain, with yours.
now test the website, start Apache and browse to your domain, you should see your site as you did before, you have now configured your website to use Virtual Hosts
now you need to add other domains and subdomains, See Here
I recently played around with Apache and fond it incredibly educational.
I used Apache for multiple websites and sub-domains, and its a great web server. and I like Xampp’s user Interface, allowing me to edit, configure and Error check my site.
Xampp’s user interface, server side
Don’t get me wrong though, there are some downfalls when putting it through its paces using Owncloud I discovered that php supported was only allowing 2GB uploads, because it is 32Bit, I later discovered that Xampp is only 32Bit for Windows. This was a major disappointment for me, but I still found workarounds.
Apache is great and easy to use with Xampp, I recommend that anyone wanting to get into web servers and general Web hosting try it out first. I hosted it on my Windows Server, But using a server is completely unnecessary, I was also able to run it on my Laptop.
For a test Environment or to start out on Web Servers, I recommend Xampp. Its a trade up over usability and performance on Windows.