
Hi all,
I am using Apache2Triad on a Windows server. I would like to have another separate website on the same server. I can achieve this by setting up virtual Apache Servers, but how do I do this please?
Thanks
Z

Add a virtualhost to your httpd.conf like this:
(change paths for windoze)
Code:<VirtualHost *:80> ServerName www.server1.yourdomain.sch.uk ServerAlias www.server1.yourdomain.org.uk DocumentRoot /var/www/vhosts/server1/html ErrorLog /var/www/vhosts/server1/logs/error_log CustomLog /var/www/vhosts/server1l/logs/access_log combined <Directory /var/www/vhosts/server1/html> AllowOverride All </Directory> </VirtualHost>

Where about in the config file will that live? also will I have to put quotation marks around the paths?
Thanks
Z

There should be a virtualhost section in your configuration file, if not you can probably append it to the end.
We actually have a include in our httpd.conf file and our virtualhost configurations live in a separate directory - this is quite common on nix servers.
I don't have any quotations on my machines, not sure about windows.

I do this on Windows.
Your VirtualHost directives can go anywhere, but always after the NameVirtualHost:
This tells Apache you want to use name-based hosting on that IP, or in this case all of them, and port 80.Code:NameVirtualHost *:80
Then your VirtualHost directives must match this declaration (i.e. you can't declare a wildcard NameVirtualHost but then single IP VirtualHosts - they must all be wildcard. You can declare NameVirtualHost multiple times for different IPs or ports).
Practically any directive can go in a virtual host container. The first host to match the servername or serveralias directives gets the request. If none match, the request is served by the first host you declared, so watch out for that.Code:<VirtualHost *:80> ServerName myserver ServerAlias myserver.myhost.mysuffix DocumentRoot C:/Apache/htdocs </VirtualHost>
If you have defined your ServerRoot properly, you can use relative paths for the DocumentRoot and other directives, just as you would declare them normally.

Ok i think i get that, i will give you a shout if a get stuck
Thanks allot

Apache Virtual Host documentation - Apache HTTP Server is your friend.
There are currently 1 users browsing this thread. (0 members and 1 guests)