Jump to content

Recommended Posts

Posted

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

Posted

Add a virtualhost to your httpd.conf like this:

(change paths for windoze)

   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
   
       AllowOverride All
   


Posted

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

 

Thanks

 

Z

Posted

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.

Posted

I do this on Windows.

 

Your VirtualHost directives can go anywhere, but always after the NameVirtualHost:

 

NameVirtualHost *:80

 

This tells Apache you want to use name-based hosting on that IP, or in this case all of them, and port 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).

 


   ServerName myserver
   ServerAlias  myserver.myhost.mysuffix
   DocumentRoot C:/Apache/htdocs

 

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.

 

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...