homepage Welcome to WebmasterWorld Guest from 107.22.45.61
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / WebmasterWorld / The Macintosh Webmaster
Forum Library, Charter, Moderators: travelin cat

The Macintosh Webmaster Forum

    
Setting up Virtual Hosting
jasperx




msg:978362
 12:20 am on Nov 22, 2003 (gmt 0)

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

NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
     ServerName 127.0.0.1
     DocumentRoot /Users/pamelaparks/Sites
</VirtualHost>

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

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



And in the hosts file looks like this

127.0.0.1      localhost
127.0.0.1      test.officeapp.com
127.0.0.1      test.Baker.com   
255.255.255.255   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

<VirtualHost 127.0.0.1>
     ServerName 127.0.0.1
     DocumentRoot /Users/pamelaparks/Sites
</VirtualHost>

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

 

Son_House




msg:978363
 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 192.168.0.2 I can't remember for sure why but I think it was because the 127.0.0.1 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.

BjarneDM




msg:978364
 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>

<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
</Directory>
</VirtualHost>

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>
[localhost...]
at least with Apache 2.0.x - might be different if you are using Apache 1.3.x

freesample




msg:978365
 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.

BjarneDM




msg:978366
 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

freesample




msg:978367
 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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved