2

I'm getting a 403 error message with Apache, in Debian Testing.

Apache version:

# aptitude show apache2 | grep -i version
Version: 2.4.9-1

# ls -la /home/

total 28
drwxr-xr-x  4 root    root     4096 Apr  3 13:19 .
drwxr-xr-x 23 root    root     4096 Apr  4 07:28 ..
drwx------  2 root    root    16384 Apr  3 13:13 lost+found
drwx--x--x 36 username username  4096 Apr  7 13:30 username

# ls -la /home/username/Development/PHP/foo.dev.com/

total 16
drwx--x--x 4 username username 4096 Apr  3 14:35 .
drwx--x--x 6 username username 4096 Apr  3 14:36 ..
drwx--x--x 2 username username 4096 Apr  3 14:35 logs
drwx--x--x 8 username username 4096 Apr  3 14:35 public_html

# cat /etc/apache2/sites-enabled/dev.com.conf
UseCanonicalName Off

<VirtualHost *>
    VirtualDocumentRoot "/home/username/Development/PHP/%0/public_html/"
    <Directory "/home/username/Development/PHP/%0/public_html/">
        Require all granted
    </Directory>
</VirtualHost>

# cat /var/log/apache2/error.log
[Mon Apr 07 14:08:15.069251 2014] [authz_core:error] [pid 8649] [client 127.0.0.1:48578] AH01630: client denied by server configuration: /home/username/Development/PHP/foo.dev.com/public_html/

Firefox, "No proxy for" configuration: localhost, 127.0.0.1, *.dev.com

# cat /etc/hosts:
hosts        hosts.allow  hosts.deny
root@username:/home# cat /etc/hosts
127.0.0.1   localhost
127.0.1.1   username.mymachine.local    username

# Custom
127.0.0.1   teste.dev.com

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

UPDATE 1:

SELinux does not seems to be installed:

$ aptitude search ~i | grep selinux
i   libselinux1                     - SELinux runtime shared libraries

UPDATE 2:

$ ls -la /home/
total 28
drwxr-xr-x  4 root    root     4096 Apr  3 13:19 .
drwxr-xr-x 23 root    root     4096 Apr  4 07:28 ..
drwx------  2 root    root    16384 Apr  3 13:13 lost+found
drwx--xr-x 38 username username  4096 Apr  9 08:26 username
Jenny D
  • 27,780
  • 21
  • 75
  • 114
Thom Thom Thom
  • 123
  • 1
  • 5

3 Answers3

1

client denied by server configuration: /home/username/Development/PHP/foo.dev.com/public_html/

This make me think about a similar issue i had :

Ensure that www-data user has the x bit permission set for each folders on the path to /home/username/Development/PHP/foo.dev.com/public_html

Either by making www-data the owner of the folders : chown www-data

Or grant the x bit to others : chmod o+x

EDIT :

Finally i have been able to reproduce. It seems that %0 is not supported in <Directory> directive. I have corrected this adding a * instead :

UseCanonicalName Off
<VirtualHost *>
    VirtualDocumentRoot "/home/username/Development/PHP/%0/public_html/"
    <Directory "/home/username/Development/PHP/*/public_html/">
        Require all granted
    </Directory>
</VirtualHost>
krisFR
  • 13,280
  • 4
  • 36
  • 42
0

I'm not sure if <Directory>-directive accepts %0 as part of the path name, in the documentation only regexps are mentioned: http://httpd.apache.org/docs/current/mod/core.html#directory

Whereas ´%0´ is part of the vhost_alias-module:http://httpd.apache.org/docs/current/mod/mod_vhost_alias.html

You might try changing

<Directory "/home/username/Development/PHP/%0/public_html/">

to:

<Directory "/home/username/Development/PHP/">

and see if this is the case. You can also probably try with regexp /home/username/Development/PHP/*/public_html/

isido
  • 61
  • 4
0

client denied by server configuration: /home/username/Development/PHP/foo.dev.com/public_html/

It should be obvious that....

ls -la /home/username/Development/PHP/foo.dev.com/

... drwx--x--x 8 username username 4096 Apr 3 14:35 public_html

...the apache uid needs READ permission on the directory (and the file). To fix:

chmod -R o+r /home/username/Development/PHP/foo.dev.com/
Jenny D
  • 27,780
  • 21
  • 75
  • 114
symcbean
  • 21,009
  • 1
  • 31
  • 52
  • "chmod -R o+r /home/username/" doesn't change anything. The error remains the same. Thank you. – Thom Thom Thom Apr 09 '14 at 11:22
  • Then either your apache instance is running under the gid you have reported as 'username' [sic] or the command above was run by a uid without sufficient privelege or there a secondary issue which we can't tell from the information you've provided. – symcbean Apr 09 '14 at 11:47
  • I've run it with the root user. – Thom Thom Thom Apr 09 '14 at 11:57