Virtual host setup, no permission to access problem

Hi, I have installed apache2.2 on windows vista.

My httpd-vhosts.conf file has;


NameVirtualHost *:80

<VirtualHost *:80>
ServerAdmin someplace@gmail.com
DocumentRoot "C:/apache_second/htdocs"
ServerName default.localhost
</VirtualHost>

(the DocumentRoot … above is not of the htdocs/ from the actual apache installation folder which is in my case inside “c:/program files/apache software foundation/…”. I have symbolic links for apache’s conf/ and htdocs/ dirs in c:/apache_second. Read a tutorial that it is easier this way as it avoids the permission dialog boxes vista keeps popping up whenever you edit files insides some dirs such as c:/program files. )

<VirtualHost 127.0.0.1:80>
ServerAdmin someplace@gmail.com
DocumentRoot "F:/projects/bfe"
ServerName bfe.localhost
DirectoryIndex index.php index.html index.htm index.shtml test.php
</VirtualHost>

and I have these in my httpd.conf;

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory "C:/apache_second/htdocs">
    [B]Options +Indexes[/B] FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

#<IfModule dir_module>
    #DirectoryIndex index.php index.shtml index.html
#</IfModule>


and I have these in my c:\windows\system32\drivers\etc\hosts file;

127.0.0.1 localhost

127.0.0.1 default.localhost
127.0.0.1 bfe.localhost

I am able to run files that’s inside this symbolic folder “C:/apache_second/htdocs” with the virtual http://default.localhost/… but

  1. When I try to access the site with http://bfe.localhost it gives a “You don’t have permission to access / on this server.” error.

  2. Also I don’t get the directory listing ( with the working http://localhost or http://default.localhost ) even though I have
    Options +Indexes in the <Directory> directive and have commented out the DirectoryIndex stuff in httpd.conf .

Any idea what could be wrong?.

Apache denies to access to any directory by default. For any directory that you want it to allow access to you should create a <Directory> directive telling it to allow access. The solution here is to create a <Directory> directive for F:/projects/bfe similar to <Directory “C:/apache_second/htdocs”> :slight_smile:

It could be that your Directory / is what is applied to your VirtualHost. Since it IS a VirtualHost, I don’t believe that you need to be so restrictive so I’ve opened mine up and that seems to have cured this problem for me.

Regards,

DK

Setting up a <Directory /> directive inside the <Virtualhost *:80> directive like;

<VirtualHost *:80>
ServerAdmin someplcae@gmail.com
DocumentRoot "F:/itech_dev/bfe"
ServerName bfe.localhost
[B]DirectoryIndex index.php index.html index.htm index.shtml test.php[/B]
<Directory "F:/itech_dev/bfe">
    [B]Options Indexes[/B]
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>

did solve the -permission denied- problem. Cheers ScallioXTX.