# Apache2 VirtualHosts

## GeoffOs

I am attempting to set up VirtualHosts with the following taken from my vhosts.conf file

```

<VirtualHost *:80>

        ServerName george.osbaldestin.net

        DocumentRoot /var/www/george/htdocs

</VirtualHost>

<VirtualHost *:80>

        DocumentRoot /var/www/localhost/htdocs/mildred

        ServerName mildred.osbaldestin.net

</VirtualHost>

```

Mildred works, but it is a sub dir of the main web site, george gives me a permissions error.

What should be the permissions for apache to:

Read the directories

Read the files

I have attempting to set the owner with

chown apache:root .....

But this does not seem to make any difference.

Can anyone suggest what I need to do (Please    :Laughing:  )

----------

## 87C751

Make sure all the directories in the path from the root are world executable. Look at george and george/htdocs... they should be 755.

----------

## GeoffOs

What exactly do you mean?

I have reset the permissions on htdocs with chmod 755, but this doesn't seem to have changed anything.

The error_log shows;

```

[Thu Jan 08 16:30:05 2004] [error] [client ********] client denied by server configuration: /var/www/george/htdocs/
```

And the page returned says:

```

Forbidden

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

Apache/2.0.48 Server at george.osbaldestin.net Port 80
```

----------

## fleed

User VirtualDocumentRoot instead. 

Also, make sure that the whole route to htdocs is executable otherwise apache won't be able to get there. What do your access.log and error.log show?

----------

## Souperman

 *GeoffOs wrote:*   

> 
> 
> The error_log shows;
> 
> ```
> ...

 

Sounds like you need to tell Apache that it's ok to read from the directory.  Example (customise and place in each <VirtualHost> container):

```

<Directory /same/path/as/document/root>

    # These are what I have - might not be what you want

    Options Indexes FollowSymLinks MultiViews

    # Again, you may want different settings here

    AllowOverride All

    <IfModule mod_access.c>

      Order allow,deny

      Allow from all

    </IfModule>

</Directory>

```

HTH

----------

## GeoffOs

Still no Joy   :Sad: 

Note sure what I have buggered.

Hmmm

I have check that the whole path to george has excute

I have checked added apache as an owner.

I have tried Souperman's idea (thanks) of  *Quote:*   

> 
> 
> <Directory /same/path/as/document/root>
> 
>     # These are what I have - might not be what you want
> ...

 

Any my access_log still says:

```

[Thu Jan 08 19:45:34 2004] [error] [client 10.0.50.2] client denied by server configuration: /var/www/george
```

Not sure what else to do, and as the saying goes, i have not got much hair left.

Please offer any suggestions (apart from themo-nuclear devices) as I cannot think of anything else to try.

----------

## slartibartfasz

 *GeoffOs wrote:*   

> I am attempting to set up VirtualHosts with the following taken from my vhosts.conf file
> 
> ```
> 
> <VirtualHost *:80>
> ...

 

u know that u can use '*' only with the NameVirtualHost directive... try with ip adresses or post the whole vhosts.conf

----------

## Souperman

 *slartibartfasz wrote:*   

> u know that u can use '*' only with the NameVirtualHost directive... try with ip adresses or post the whole vhosts.conf

 

Errr... no.  I use <VirtualHost *> for all my vhosts and they work perfectly.

Unless you meant to say "You should also have 'NameVirtualHost *' before all your <VirtualHost *> containers"?

----------

## slartibartfasz

 *Souperman wrote:*   

> Unless you meant to say "You should also have 'NameVirtualHost *' before all your <VirtualHost *> containers"?

 

exactly - sorry was a bit misleading

----------

## thecooptoo

        ServerName george.osbaldestin.net 

          ServerName mildred.osbaldestin.net 

have you got entries in your client /etc/hosts

point http://george & http://mildred...

...... to your server IP address

----------

