Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Virtual host configuration for Apache' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Virtual host configuration for Apache
Authored by: Anonymous on Mar 13, '03 03:07:49PM

Under Mac OS X 10.2 (a.k.a. Jaguar)

step 1 edit your `/etc/hosts` file like this:

##
# Host Database
#
# Note that this file is consulted when the system is running in single-user
# mode. At other times this information is handled by lookupd. By default,
# lookupd gets information from NetInfo, so this file will not be consulted
# unless you have changed lookupd's configuration.
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 www.yoursite1.test
127.0.0.1 www.yoursite2.test


step 2 edit your `/etc/httpd/httpd.conf` file like this:
at the end of the file;

#
# 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 *>
# ServerAdmin webmaster@dummy-host.example.com
# 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>
<VirtualHost *>
DocumentRoot /Library/WebServer/Documents/www.yoursite1.test
ServerName www.yoursite1.test
</VirtualHost>
<VirtualHost *>
DocumentRoot /Library/WebServer/Documents/www.yoursite2.test
ServerName www.yoursite2.test
</VirtualHost>

Now reboot your apache, and it should be all good!



[ Reply to This | # ]