+ Post New Thread
Results 1 to 7 of 7
How do you do....it? Thread, Virtual Apache Servers in Technical; Hi all, I am using Apache2Triad on a Windows server. I would like to have another separate website on the ...
  1. #1

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,781
    Thank Post
    865
    Thanked 1,665 Times in 1,450 Posts
    Blog Entries
    11
    Rep Power
    442

    Virtual Apache Servers

    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

  2. #2


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339
    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>

  3. #3

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,781
    Thank Post
    865
    Thanked 1,665 Times in 1,450 Posts
    Blog Entries
    11
    Rep Power
    442
    Where about in the config file will that live? also will I have to put quotation marks around the paths?

    Thanks

    Z

  4. #4


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339
    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.

  5. #5

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    I do this on Windows.

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

    Code:
    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).

    Code:
    <VirtualHost *:80>
        ServerName myserver
        ServerAlias  myserver.myhost.mysuffix
        DocumentRoot C:/Apache/htdocs
    </VirtualHost>
    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.

  6. #6

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,781
    Thank Post
    865
    Thanked 1,665 Times in 1,450 Posts
    Blog Entries
    11
    Rep Power
    442
    Ok i think i get that, i will give you a shout if a get stuck

    Thanks allot

  7. #7

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182

SHARE:
+ Post New Thread

Similar Threads

  1. Apache Virtual Hosting
    By Steven in forum Wireless Networks
    Replies: 6
    Last Post: 25th May 2008, 11:27 PM
  2. VMware/Virtual servers?
    By flashsnaps in forum Thin Client and Virtual Machines
    Replies: 32
    Last Post: 12th February 2008, 06:14 PM
  3. Virtual Servers Hosting
    By russdev in forum Web Development
    Replies: 17
    Last Post: 11th May 2007, 09:46 AM
  4. Apache + IIS On the same box?
    By in forum Windows
    Replies: 25
    Last Post: 7th March 2006, 03:12 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •