Forum Moderators: phranque

Message Too Old, No Replies

Virtual Hosts Configuration

         

JayFM

8:58 am on Oct 5, 2008 (gmt 0)

10+ Year Member



Hello Everyone,

I have just set up an Apache server on my local network, and require it to be accessed from different URIs, such as live.network.local, or *.network.local, with the websites document root being set to F:/live or F:/* respectively.

The server also has two network interfaces, 192.168.0.2 and 192.168.1.1, as well as a hostname, svr1. When any of these are accessed, I want it to point to the live version of the site, or F:/live.

I have tried using VirtualHost containers, and also the VirtualDocumentRoot directive, but with no success.

Is there anything specific that I am missing or not doing correctly?

Any help would be greatly appreciated. If you need any more information, ask and I shall post it.

Cheers,
Jay

jdMorgan

2:16 pm on Oct 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'll probably need to set up the server using both the IP-based Vitual Host and Name-based Virtual Host examples given in the Apache Virtual Hosts [httpd.apache.org] documentation. To be clear, these will be three different vHosts all pointed to the same DocumentRoot.

Then add definitions to your operating system's "hosts" file to point the hostnames to one of the two IP addresses.

I believe you'll have to define the name-based server first, otherwise the name-based vHost container will never be used, because the IP address will aready have been looked up in your hosts file.

The hosts file is present in all operating systems, but its location varies. The name of the file is always just "hosts" -- no file extension. It is a plain-text file (ASCII) and should be edited using a plain-text editor such as NotePad on Windows or vi on *nix.

Jim