Forum Moderators: phranque

Message Too Old, No Replies

Strange Virtual Host Problems

         

rigadon

12:08 am on Mar 1, 2007 (gmt 0)

10+ Year Member



Hi everyone!

I am using the latest version of Apache (downloaded today) on Windows XP. I have setup a virtual host for a website hosted in the /httpd/testing/wwwroot/ directory on my computer. I have commented IN the following line in httpd.conf:

Include conf/extra/httpd-vhosts.conf

And I have added the required VirtualHost entries to the httpd-vhosts.conf file:

NameVirtualHost *:80

<VirtualHost *:80>

</VirtualHost>

<VirtualHost *:80>

 ServerAdmin webmaster@localhost.testing

 DocumentRoot /httpd/testing/wwwroot/

 ScriptAlias /cgi-bin/ /httpd/testing/wwwroot/cgi-bin/

 DirectoryIndex index.html

 ServerName localhost.testing

 ErrorLog logs/localhost.testing-error_log

 CustomLog logs/localhost.testing-access_log common

</VirtualHost>

Accessing [localhost...] works fine but [localhost.testing...] gives me a 403 Forbidden error. If I set the DocumentRoot directive to the same as in the main httpd.conf (<installation directory>/htdocs) it works fine. I've also tried creating an index.html file in <installation directory>/htdocs/x and using this as the DocumentRoot. This works fine too.

The only conclusion I can come to is that it is down to permissions on the folder. But so far as I am aware Apache has access to read the folder I have directed it to.

Please anyone who can help I would greatly appreciate it as I need to get this fixed ASAP.

Thanks
Jay

equalm

12:18 am on Mar 1, 2007 (gmt 0)

10+ Year Member




You probably have something like

<Directory />
...
Deny from all
</Directory>

You need to create another <Directory> directive of

<Directory /httpd/testing/wwwroot>
... (whatever options you want)
Allow from all
</Directory>

Default Apache httpd.conf usually have this, and they expect you to manually add (or change) the directive so that you enable access to the folder you specify.

I'm 90% sure this is your issue.

-George

rigadon

8:35 am on Mar 1, 2007 (gmt 0)

10+ Year Member



Awesome! Thanks Gerorge - that did the trick.

Is there any way to specify this in the VirtualHost block? Otherwise I'll have to list all the directories twice...

Thanks again!