Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've looked at Apaches documented Dynamically configured mass virtual hosting, from which I've taken

UseCanonicalName Off
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog /tmp/access_log vcommon
VirtualDocumentRoot /var/www/localhost/htdocs/%0/web
VirtualScriptAlias /var/www/localhost/htdocs/%0/web

My expectation is that for my local development server, this will save me from needing to set up a new vhost file for every new domain I start with.

  1. To make sure Apache is picking up the file, I add some junk, "dlkmvasp" to the top, check that I get a syntax error, remove junk, and restart the server again.
  2. I add a few domains to /etc/hosts, and try to access loc.example.com.
  3. "tail -f /tmp/access_log" now yields "loc.example.com 127.0.0.1 - - [04/Mar/2012:11:37:03 +0100] "GET / HTTP/1.1" 403 265"

How do I debug this? I can post all the vhost config is it's helpful, I just didn't wanna start of with a wall of text if it is not necessary.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Since you're getting a 403 rather than a 404 it looks like it's being found; do you just need something like:

<Directory /var/www/localhost/htdocs>
    Order allow,deny
    Allow from all
</Directory>

?

share|improve this answer

In your example loc.example.com will have a DocumentRoot of /var/www/localhost/htdocs/loc.example.com/web.

Check that the path /var/www/localhost/htdocs/loc.example.com/web and files in the web directory have suitable permissions to allow Apache to access them. For the directories apache will need r-x permissions and for the files it will need r--

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.