Here is a little info I'd like to share with you since I've wanted to have this option on my laptop for a while but not until now I was able to figure it out.
Most people run multiple websites of the same machine. Apache provides Virtual Host capabilities and you can configure to run a different site just depending on the url being called. This is pretty basic when you have some DNS pointing different URLs to one IP but I often wondered how to set it up on my laptop when not connected to the internet.
I do a bunch of testing and decelopment on multiple sites that I have locally on my laptop. Until now I would set the Document root to one of the sites, and so when I typed in localhost in the url that site would come up. To switch to a different local sire I would change the document path in the httpd.conf file, restart, and then the other site would come up when I entered the localhost url.
So here is my new setup. (By the way I am running windows)
Let's say that I have 3 sites locally on my laptop Pinkbike, Biglines, and test1. Each one of these sites resides in a different directory. Here are the steps to enable you ta access any of these sites locally.
First search fo a file called hosts from your windows/winnt directory. It could be burried a few dirs down do just run a search command. When you open up this file you may should see something like this.
127.0.0.1 localhost
Now add the following so it looks like this.
127.0.0.1 localhost
127.0.0.1 pinkbike
127.0.0.1 biglines
127.0.0.1 test1
These new mappings will be used to call different sites or directories on your local comupter using this name in the URL.
Now open you httpd.conf file in you apache/conf dir. Near the bottom of this file you should see something like this.
Use name-based virtual hosting.
#
#NameVirtualHost *
#
VirtualHost example:
Almost any Apache directive may go into a VirtualHost container.
The first VirtualHost section is used for requests without a known
server name.
#
#<VirtualHost *>
DocumentRoot /www/docs/dummy-host.example.com
ServerName dummy-host.example.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
Now change this to read something like this
NameVirtualHost *
#
VirtualHost example:
Almost any Apache directive may go into a VirtualHost container.
The first VirtualHost section is used for requests without a known
server name.
#
<VirtualHost *>
ServerAdmin rburkat@pinkbike.com
DocumentRoot d:\web\pinkbike
ServerName pinkbike
</VirtualHost>
<VirtualHost *>
ServerAdmin rburkat@pinkbike.com
DocumentRoot d:\web\biglines
ServerName biglines
</VirtualHost>
<VirtualHost *>
ServerAdmin rburkat@pinkbike.com
DocumentRoot d:\web\test1
ServerName test1
</VirtualHost>
The DocumentRoot point to your local dir where the site resides.
Now just save, and restart your apache.
If you now type in http://pinkbike or http://biglines or http://test1 in the URL of your browser you will load the sites/files that are in the respected directories.
Pretty obvious to some of you I'm sure but it wasn't to me and I searched for quite some time to try and figure out how to do this on a local windows machine.
Radek