Lost virtual hosts

Since the last OS X security upgrade, I seem to have lost access to my virtual hosts set up using NetInfo and the Apache httpd.conf file, e.g.

<VirtualHost *:80>
DocumentRoot /Library/WebServer/Documents/rbcdl.org.uk
ServerName test.rbcdl.org.uk
</VirtualHost>

Only one of them works, plus localhost. The rest are completely ignored and so I am directed to non-existent host names on the Internet instead of local files. This has worked fine for years on both the Macbook and its predecessor the late iBook. Anyone else found this problem or solved it?

iBook G3 (deceased), MacBook, Mac OS X (10.4.7)

Posted on Aug 3, 2006 8:24 AM

Reply
11 replies

Aug 3, 2006 3:40 PM in response to David Chadderton

If you could post the entire virtualServer section without compromising anything that might help us pick out a typo.

Also, any other changes in your network setup?
Did your host machine maintain its static IP that it had before?
Are these accessible from the internet, or are they only supposed to be viewable on your intranet?

Sounds like you're trying to do name-basd virtual host. Yes?
http://httpd.apache.org/docs/1.3/vhosts/name-based.html

Aug 4, 2006 12:01 AM in response to dotgray

NetInfo entry for this under /machines/test.rbcdl.org.uk

ip_address 127.0.0.1
name test.rbcdl.org.uk
serves ./local

This is the same as all the other virtual host names, except for the name.

This is just a standalone machine that until yesterday has successfully served up several local web sites without any problems since I got it, and before this it worked on the iBook under Tiger and Jaguar with the same settings. Nothing has been changed. I do not access these sites from any other machine on the network. I don't even own this particular domain name any longer, but until yesterday it worked perfectly on the local server.

iBook G3 (deceased), MacBook Mac OS X (10.4.7)

Aug 4, 2006 12:09 AM in response to Rick Van Vliet

I don't think I'm compromising anything as these sites are only served locally. The virtual server section of httpd.conf is:

### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at <URL:<a class="jive-link-external-small" href="http://">http://www.apache.org/docs/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# 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 *:80>
# 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 *:80>
DocumentRoot /Library/WebServer/Documents
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /Library/WebServer/Documents/mainstreamstudios.co.uk
ServerName test.mainstreamstudios.co.uk
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /Library/WebServer/Documents/mainstreamstudios.co.uk/new
ServerName new.mainstreamstudios.co.uk
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /Library/WebServer/Documents/new.rbcdl.org.uk
ServerName new.rbcdl.org.uk
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /Library/WebServer/Documents/rbcdl.org.uk
ServerName test.rbcdl.org.uk
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /Library/WebServer/Documents/theatreresearch.org
ServerName test.theatreresearch.org
</VirtualHost>


Of these virtual hosts, 'localhost' and 'test.theatreresearch.org' work and the others are ignored and I am sent to non-existent sites on the Internet.

My network setup hasn't changed. The web pages should only be served locally to 127.0.0.1. The MacBook's IP address on the local network is set by a wireless broadband router, which is on a fixed IP address to the Internet, but these shouldn't affect anything as far as I know.

iBook G3 (deceased), MacBook Mac OS X (10.4.7)

Aug 4, 2006 4:47 AM in response to David Chadderton

There seems to be something gone haywire with your local DNS...if this all worked a few days ago.
http://mainstreamstudios.co.uk
and
http://theatreresearch.org/
seem to be serving from out here. (not sure if they're both yours).
Seems that when you type the http://"whatever" into browser, the Netinfo info is most likely being ignored, and you're being directed out on the Web, instead of back to 127.0.0.1...

As far as rbcdl.org.uk, looks like a recent new registration
http://www.dnsstuff.com/tools/whois.ch?ip=rbcdl.org.uk
Relevant dates:
Registered on: 06-Jul-2006
Renewal date: 06-Jul-2008

Check local DNS

Aug 4, 2006 10:05 AM in response to Rick Van Vliet

Yes, the root domains for mainstreamstudios.co.uk and theatreresearch.org are my sites, and rbcdl.org.uk used to be a domain I owned but I let lapse, and it seems that someone else has re-registered it. I use the original domain names with a dummy TLD ('test' or 'new') to point to my local test sites.

I've tried pinging the domain names that should be local; test.theatreresearch.org pings 127.0.0.1 as it should, but the others go straight to the Internet. I don't understand why one is working and not the others - especially as they were all working just a few days ago!

I'm afraid I don't know where to start checking local DNS problems on the Mac. Any pointers to help me?

Thanks all.

iBook G3 (deceased), MacBook Mac OS X (10.4.7)

Aug 4, 2006 1:47 PM in response to David Chadderton

OK. Something to try.

Save a copy of your current httpd.conf file, so you have a backup.

Leave your public virtual hosts (unless they're really hosted somewhere else)as they are in httpd.conf.
For the fictitious ones, try changing to something like this:

NameVirtualHost 127.0.0.1

<VirtualHost 127.0.0.1>
DocumentRoot "C:\My Sites\Site1"
ServerName site1.local
</VirtualHost>

<VirtualHost 127.0.0.1>
DocumentRoot "C:\My Sites\Site2"
ServerName site2.local
</VirtualHost>

You'll probably want to find your "hosts" (probably in /private/etc/ directory) file on the mac, and edit it.

add the following lines to the bottom:
127.0.0.1 site1.local
127.0.0.1 site2.local
(replace sitex.local with your fictitious sitename.)

Restart apache. SystemPreferences>Sharing>WebSharing, stop then start.
Here's where I got this.
Step 1, google http://www.google.com/search?hl=en&q=testinglocal+virtualapache
Step 2, click http://www.apptools.com/phptools/virtualhost.php
(it's Windoze-based, but the concept is Apache,

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Lost virtual hosts

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.