homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / The Macintosh Webmaster
Forum Library, Charter, Moderators: travelin cat

The Macintosh Webmaster Forum

Setting up Virtual Hosting

10+ Year Member

Msg#: 337 posted 12:20 am on Nov 22, 2003 (gmt 0)

I set up virtual hosting for a site
in the httpd.conf:

     DocumentRoot /Users/pamelaparks/Sites

<VirtualHost test.officeApp.com>
   ServerName test.officeApp.com
   DocumentRoot /Users/pamelaparks/Sites/officeApp/

<VirtualHost test.Baker.com>
   ServerName test.Baker.com
   DocumentRoot /Users/pamelaparks/Documents/WebDesignPam/MySites/Baker_folder/Baker

And in the hosts file looks like this      localhost      test.officeapp.com      test.Baker.com   broadcasthost
::1             localhost 

Then I ran a sudo apachectl graceful.. it restarted. Then I tried test.officeApp.com and test.Baker.com in a browser and I get the baker site when the url used is test.officeApp! test.Baker.com gives me a server not found and then when I retry the test.officeApp I get a listing of the contents of Sites. This seems really weird!

It does seem odd to me to

     DocumentRoot /Users/pamelaparks/Sites

but did so because of an O'Reilly article on locating Web Site Files



10+ Year Member

Msg#: 337 posted 3:58 am on Nov 22, 2003 (gmt 0)

Is your Mac hooked up to a router? I did this awhile back but I used NameVirtualHost I can't remember for sure why but I think it was because the did not work right for me.

If your are hooked up to a router, you could try using the ip that it gives your Mac and make the changes in httpd.conf and hosts. Thats the way I did it and it worked for me.


10+ Year Member

Msg#: 337 posted 4:21 pm on Nov 22, 2003 (gmt 0)

I don't like your usage of ip-numbers and host-names in the <VirtualHost>

Try this instead:

NameVirtualHost *
<VirtualHost *>

<VirtualHost *> 
ServerAdmin mozilla@mathiesen.info
ServerName test.mozilla.info
DocumentRoot "/Volumes/brugere/bjarnema/Mozilla/Documents"
<Directory "/Volumes/brugere/bjarnema/Mozilla/Documents">
Options Indexes
AllowOverride All
Order allow,deny
Allow from all

The first empty VirtualHost will default to the way the server has been configured in the main body of the httpd.conf file.

The following URL should give you the manual entry for <VirtualHost>
at least with Apache 2.0.x - might be different if you are using Apache 1.3.x


10+ Year Member

Msg#: 337 posted 4:45 pm on Nov 25, 2003 (gmt 0)

did you open NetInfo Manager under the utilities folder?

you have to create an appropriate machine for each virtual folder.


10+ Year Member

Msg#: 337 posted 8:06 pm on Nov 25, 2003 (gmt 0)

It's not necessary to mess around with Netinfo Manager.
Editing the file /etc/hosts is quite suffcient no matter what the comment in /etc/hosts says.

If yoo do a 'lookupd -configuration' you'll find the following lines:

LookupOrder: Cache FF DNS NI DS 
_config_name: Host Configuration

which means that the lookupd daemon first tries to find a hostname in the following order:
- it's own cache
- in flat files (FF) like /etc/hosts
- DNS lookup
- NetInfo
- DS
so /etc/hosts is in fact apparently consulted before NetInfo


10+ Year Member

Msg#: 337 posted 5:16 pm on Nov 27, 2003 (gmt 0)

really... without setting up the NetInfo Manager for me was impossible to make the VirtualHost working...

Global Options:
 top home search open messages active posts  

Home / Forums Index / WebmasterWorld / The Macintosh Webmaster
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved