# apache2 vhosts getting 403 forbidden

## adpowers

Hello all. I have a few day old thread in here about some problems with Apache 1.3.29. Since then, I decided to stop trying to swim against the tide and I upgraded to Apache2 with a fresh config. 

The server worked just fine with minimal changes to the configuration settings, but things screwed up when I set up vhosts. It works fine again if I remove the vhosts. Here is my vhosts files:

```
NameVirtualHost *

<VirtualHost *>

 DocumentRoot /home/andrew_hitchcock/www/iis

 ServerName microshaft.com

 ServerAlias microshaft.com *.microshaft.com

 DirectoryIndex index.html

 SuExecUserGroup andrew_hitchcock users

 <Directory "/home/andrew_hitchcock/www/iis">

  Options ExecCGI FollowSymLinks Includes IncludesNOEXEC Indexes MultiViews

  AllowOverride none

  Order allow,deny

  Allow from all

 </Directory>

</VirtualHost> 
```

I currently have the permissions for that folder (~/www/iis) set to 700, is this correct? Every time I try to connect to the server, I get 403 forbidden. Note, the server-status command works normally, but when I add the vhost, it stops working as well.

Again, any help would be greatly appreciated. Thanks,

Andrew

----------

## npmccallum

 *adpowers wrote:*   

> Hello all. I have a few day old thread in here about some problems with Apache 1.3.29. Since then, I decided to stop trying to swim against the tide and I upgraded to Apache2 with a fresh config. 
> 
> The server worked just fine with minimal changes to the configuration settings, but things screwed up when I set up vhosts. It works fine again if I remove the vhosts. Here is my vhosts files:
> 
> ```
> ...

 

I too am having this problem.  When I disable my vhost, the server runs fine.  When I enable the vhost, 403 on both the vhost and any other access.  Here is my vhost.conf file:

```

################# gentoo.natemccallum.com

NameVirtualHost *

<VirtualHost *>

   ServerName gentoo.natemccallum.com

#   ServerPath /etc/apache2

   DocumentRoot /var/www/gentoo.natemccallum.com/htdocs/

</VirtualHost>

```

All my permissions are set right (world readable).  If you disable the vhost, the server works.  Very strange...  Have you found any solution?

----------

## adpowers

No, unfortunately, I haven't figured it out yet. However, I haven't been trying very much the last few days. My friend suggested I just install from the Apache souces (not using ebuilds). I would love to hear of anyone that has had success.

Andrew

PS: Thanks for the bump  :Smile: .

----------

## npmccallum

Have you tried posting it to the gentoo-user mailing list?

----------

## adpowers

No, I am not subscribed. However, if you send it in, I would love to hear the results.

----------

## Beerke

I got the following settings of my vhosts, maybe they are of help to you

 *Quote:*   

> 
> 
> NameVirtualHost *
> 
> <VirtualHost *:*>
> ...

 

----------

## adpowers

Okay, I just tried that (modifying it to use my paths) and it didn't work.

BTW, here are my permissions for the www directory, is this correct?

```
drwxr--r--    3 andrew_hitchcock users         104 Dec 23 03:59 www

```

Thanks,

Andrew

----------

## jaxn

I am getting the same error and it is very frustrating.

I think there is something wrong here.

I have production apache installations that I manage vhosts all the time, but something about this setup is not working for me at all.

-Jackson

----------

## Telamon

The dir permissions have to be 755 (drwxr-xr-x)  For directories, the execute flag means you are alowed to access the directory.  If you don't have execute  permissions on a dir, you can't access any file in that dir, no matter what the individual file permissions for the file are.

----------

## adpowers

I've tried chmodding it to 755, with no luck. What user name should it be under? Currently it is chowned with my user and group.

After given up with the ebuild, I tried installing Apache2 from source. I still get the same problem. Here is my error log:

```
[Thu Feb 12 22:49:31 2004] [error] [client 192.168.1.123] (13)Permission denied: access to / denied
```

I don't think it should be a / here. Shouldn't it point to the directory on the filesystem it can't access? However, if I comment out the default line of:

 *Quote:*   

> <Directory />
> 
>     Options FollowSymLinks
> 
>     AllowOverride None
> ...

 

Then I get this error message:

```
[Thu Feb 12 22:39:36 2004] [crit] [client 192.168.1.123] (13)Permission denied: /home/<username>/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

```

It should try to access that .htaccess file because AllowOverride is off and that isn't the directory I specified for DocumentRoot, I specified /home/<username>/www/

Any comments? Thoughts? This is really starting to frustrate me because I want to get this machine up and running all my production stuff.

Thanks,

Andrew

----------

## shireRom

Hi,

try to put the <Directory>-Tag outside the <VirtualHost>-Tag.

This should work.

----------

## Halcy0n

If you do chmod a+x your_home_dir, it should work.  I didn't want to make my home directory executable by all though, so I just added apache into the users group in /etc/group and then set my home dir to 710, so just the group will have executable access.  Hope this helps.

----------

