Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Web server suddenly stopped resolving virtual hosts

Not sure exactly when this started but, to my knowlege, I haven't done anything with my web server configs in a very long time. This morming, when I went to visit one of the four sites hosted on my server, I got this:


Forbidden

You don't have permission to access / on this server.

Apache/2.2.20 (Unix) mod_ssl/2.2.20 OpenSSL/0.9.8r DAV/2 PHP/5.3.6 with Suhosin-Patch Server at golf1500.com Port 80

When I checked the server error logs, I see this:


[Mon Nov 28 10:47:27 2011] [crit] [client 208.105.236.250] (13)Permission denied: /Volumes/Server/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable


Now, clearly it's trying to find the site in the root folder of that drive when, for example, that site's document root should be:


/Volumes/Server/Web/Golf1500_Site


I checked the contents of 0000_any_80_golf1500.com.conf and the DocumentRoot is still correctly defined there. Again, there are four sites hosted on this server and I get the same problem with all four of them, so clearly some global configuration has gotten changed or corrupted but I'm not sure what to look for.


Any ideas?


Many thanks in advance!

MacBook Pro 17, Mac OS X (10.7), Mac Mini Server; Time Capsule

Posted on Nov 28, 2011 7:52 AM

Reply
11 replies

Nov 28, 2011 11:06 AM in response to Spinland

Another data point: if I go into Server.app and change the folder location of any of the hosted URLs to the default folder for Lion Server it resolves normally. It's when I change it back to the actual site folder on the second internal hard drive in the Mini Server that it stops at the root of the drive and looks for .htaccess instead of resolving to the actual folder. I can't repair permissions on the second drive, that option is unavailable from Disk Utility.


Anyone have an idea? Thanks!

Nov 28, 2011 12:27 PM in response to Spinland

Well, more information on the issue, and I'm frankly surprised no one thus far seems to know what's going on.


TO get virtual hosting going in the first place I had to resort to the hack of adding the file "0000_MoreTestingRequired.conf" to the sites folder, containing "NameVirtualHost *:80"


I've read a number of other ideas for getting that directive into play, including adding it directly to httpd.conf or uncommenting the line in that file that includes a different vhosts.conf file that has it. Neither of those seems to work at all with this web server, and here's why:


When I start up the web server with Server.app and the 0000_etc file is there, I get a warning in the log file that says "NameVirtualHost *:80 has no VirtualHosts." If I comment that line out in the hack file and try the include file method, I don't get that warning, which seems to be telling me the directive never gets read.


That I'm getting the warning is also troublesome, though, because Server.app is creating a pile of VirtualHost definitions when the web server is started up, all in the sites folder. Are those now not getting read somehow?


What is the new, current and definitive way to get virtual hosts by name working in Lion Server 10.7.2? I've googled on this massively and all the advice either doesn't work and/or contradicts other advice, and this used to be working, dangit! Why did it suddenly stop?


Doesn't anyone have a clue what is going on?


Thanks in advance!

Nov 29, 2011 3:50 AM in response to chiccorosso

Thanks for responding. No, there are four websites on the same Lion Server installation, and they are just simple HTML. The problem appears to be the virtual host information for the sites is simply not being read. Every site resolves to the root folder of the drive where the sites are stored instead of where the virtual host file defines each document root to be.


I have tried resetting the web server to factory defaults and then recreating every virtual host entry using Server.app and restarting everything but it made no difference. The error log still complains that I have virtual hosting enabled but no virtual hosts defined.


Any other ideas?


Thanks in advance!

Nov 29, 2011 5:46 AM in response to Spinland

So far I would:


1. get a clean installation of the config files (located in /etc/apache2).

2. check DNS configuration

3. Reconfigure my virtual hosts using the server application.

4. Make sure my websites folders are owned by 'www' user

(cd <MyWebsiteFolder>)

(sudo chown -R www *)


Could be you accidentally deleted/commented the include sites/*.conf directive, or something similar.


Let me/us know if you get to something


EDIT: not sure if "www" user is now "_www".... please check.

Nov 29, 2011 5:53 AM in response to chiccorosso

Thanks. I've done 1-3 already, and it didn't help. When you reset the web server to factory defaults it wipes all the virtual host .conf files already, and then they are recreated by Server.app when you enter them back into the app.


I believe the web server account is _www for Lion Server, but that having ownership of the folders shouldn't be required. It's not needed for the default web folder (/Library/Server/Web/Data/Sites/Default) and sites placed in that folder still work. As I said earlier, as early as last Friday all of this worked, and I've never changed ownership of the folders holding the web sites; they're just globally readable. The ownership gets set to the SFTP account I use when uploading the data, which is also the admin account for the server.


Thanks again. I scheduled a tech support call from Apple for this morning and hopefully they can unscrew what happened. I did everything right the first time (it worked) and I've re-checked all the steps (and re-created most of them) and this is really a puzzle.

Nov 29, 2011 6:01 AM in response to chiccorosso

Bingo. I'm an idiot. I checked the permissions on the web folder but not on the root of the drive. Somehow when I was setting up file shares on the same drive I killed read access for _www. Just reset permissions and the whole thing is working again.


Thanks, man, you helped tickle the right brain cells.


Now to cancel that service call.


Thanks again!

Web server suddenly stopped resolving virtual hosts

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