One Server, Multiple Sites - Easy Web Development

Here's a nice tip from WebmasterWorld if you have multiple sites you manage as a webmaster and want to do local development.

This is an example to set up two websites so I can access them at http://mytestsite1 and http://mytestsite2.  You can name them anything you want.  Note also that you can put any extension on the end that tickles your fancy.  Some like to have it as .loc to indicate it's a local copy.

I'm using the Apache web server on WindowsXP so I add this at the bottom of the http.conf file under the VirtualHost section:

<VirtualHost mytestsite1>
DocumentRoot "C:/Documents and Settings/Tim/My Documents/Web Sites/mytestsite1"
ServerName mytestsite1
</VirtualHost>

<VirtualHost mytestsite2>
DocumentRoot "C:/Documents and Settings/Tim/My Documents/Web Sites/mytestsite2"
ServerName mytestsite2
</VirtualHost>

Just one more thing for those on Windows.  Open the file at C:\WINDOWS\system32\drivers\etc\hosts (there is no extension so just use Notepad) and put this at the end.

127.0.0.1       mytestsite1
127.0.0.1       mytestsite2

Now restart Apache and you'll have your new test sites at http://mytestsite1 and http://mytestsite2. 


( categories: )