|
Posted by Gordon Burditt on 11/23/05 22:27
>> Edit your HOSTS file. You will find it in
>> C:\Windows\System32\Drivers\Etc\.
>
>your HOSTS probly says
>127.0.0.1 localhost
>
>below it, add
>127.0.0.2 site2
>
>goto your httpd.conf (in apache's dir, or somewhere nearby)
>look for this (around line 150) : Listen 127.0.0.1:80 or something like
>it. under it, add
>Listen 127.0.0.2:80
>
>near the bottom of httpd.conf, look for the virtualHost stuff. add this
>under whatever is there:
><VirtualHost 127.0.0.2:80>
>ServerName site2
>DocumentRoot "C:/My Documents/_websites/folderforSite2/www/"
></VirtualHost>
>
>Thats what I do, I have a test host for 23 sites that way, just adding
>1 to the IP each time. If there are less steps i could take, I'd like
>to know!
There are two methods of having Apache handle multiple sites on the
same server. The one you indicate requires multiple IPs on the
server. While you aren't likely to run out of IPs for localhost
any time soon (you've got about 16 million of them), running out
of public IPs can be a real problem, especially if you're on a DSL
line which only gives you one. Using up a whole class C (253 usable
addresses) or more for one web hosting company web server is a bit
of a waste.
The other method of doing virtualhosting is to put them all on the
same IP address (and the same port). The browser, except for those
that are SERIOUSLY out of date (and were seriously out of date in
2000), such as Netscape 2.*) will send a Host: header with the
request, indicating which host name it was for. Apache will sort
out which virtualhost is being addressed from the host name. If
you send it a host name it doesn't recognize, you'll get a default
site. Read the Apache manual for more details. You *need* to have
working DNS (or edit the HOSTS file) since putting in an IP address
to the browser will not let the browser know which site you want.
Gordon L. Burditt
[Back to original message]
|