You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Chris Betts <ch...@prosolutions.co.uk> on 2002/02/11 00:30:12 UTC

switching between local and remote copies of websites

HI

I need a little help! .... (sorry if this post is a bit long!)

At present I develop websites for hosting on a *nix/apache/php/mysql web host.

Development is performed on a Windows machine with the same versions of the hosting software installed.

To allow me to switch between the local development environment and the remote live web host I have Apache setup using VirtualHosts
and then I simply switch the hosts file to point to the IP address used by the local Development Apache VirtualHost settings...

e.g. Apache setup for the 'default' server 'localhost' is as follows

ServerName http://localhost
DocumentRoot "C:/home/localhost/public_html"
ScriptAlias /cgi-bin/ "C:/home/localhost/cgi-bin/"

ServerAdmin localadmin@localhost.co.uk
ErrorLog logs/error.log
CustomLog logs/access.log common

Then for each website hosted on the development machine I add a virtual host

#--------------------------------------------------------------------
    <VirtualHost 127.0.0.2>
    ServerName www.websitea.co.uk
    DocumentRoot c:/home/websitea/public_html
    ScriptAlias /cgi-bin/ c:/home/websitea/cgi-bin/

    ServerAdmin webmaster@websitea.co.uk
    ErrorLog logs/www.websitea.co.uk-error_log
    CustomLog logs/www.websitea.co.uk-access_log common
    </VirtualHost>

#--------------------------------------------------------------------
    <VirtualHost 127.0.0.3>
    ServerName www.websiteb.com
    DocumentRoot c:/home/websiteb/public_html
    ScriptAlias /cgi-bin/ c:/home/websiteb/cgi-bin/

    ServerAdmin webmaster@websiteb.com
    ErrorLog logs/www.websiteb.com-error_log
    CustomLog logs/www.websiteb.com-access_log common
    </VirtualHost>

#--------------------------------------------------------------------

When I want to switch to the development versions I would add the following to the hosts file:

127.0.0.2       www.websitea.co.uk
127.0.0.3       www.websiteb.com

or I remove these lines to work on the live hosted version... this is simply done via 2 batch files that copy the appropriate
version of the a hosts file to the Windows folder (9x) or winnt\system32\drivers\etc (NT/2000).

So far so good ... this all works fine!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

What I want to do now is to be able to move the development versions onto a machine on a peer to peer (p2p) network and then on any
pc on the network be able to switch from the development to web versions as required ... as before!

What I have working now is ... the PC running the Apache server (same config as above) only serves one website to any other pc on
the p2p network... this is the localhost site ... and is accessable from any other pc by entering either the server ip address in a
browser (e.g. http://192.168.100.100) or if I point each computers hosts file to the ip address of the computer running the Apache
server, for each web address that is currently a VirtualHost on the Apache server conf file... i.e.

192.168.100.100       www.websitea.co.uk
192.168.100.100       www.websiteb.com

These will both serve the localhost website from the Server machine.

I have tried switching to a name based conf where they all share the same ip address on the server machine ... but get the same
effect!?!

The main question is... How do I do this? ... Can I do this? ... am I going the right way about this?

Under network settings for TCP/IP for a network card I have 'Disable DNS' .... should I be setting up a DNS?

If so how? (do you know of a suitable online reference) and how do I make it easily changable?... I dont particularly want to have
to keep going into network settings to change the DNS entries there if there is a simple option like the use of the hosts file
above!

If I do this, would it mean that all pc's have to be in local or remote mode at one time, as a DNS would presumably be shared across
the local network?

Am I asking the right questions? I dunno!

If you have had any similar experience or a different approach to the problem some advice would be greatly appreciated.

Thanks

Chris


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.323 / Virus Database: 180 - Release Date: 08/02/02


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org