
Estou recebendo uma mensagem de erro 403 com o Apache, no Debian Testing.
Versão Apache:
# 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, configuração "Sem proxy para":
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
ATUALIZAÇÃO 1:
SELinux não parece estar instalado:
$ aptitude search ~i | grep selinux
i libselinux1 - SELinux runtime shared libraries
ATUALIZAÇÃO 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
Responder1
cliente negado pela configuração do servidor: /home/username/Development/PHP/foo.dev.com/public_html/
Isso me faz pensar sobre um problema semelhante que tive:
Certifique-se de que www-data
o usuário tenha a x
permissão de bits definida paracada pastano caminho para/home/username/Development/PHP/foo.dev.com/public_html
Seja tornando www-data
o proprietário das pastas:chown www-data
Ou conceda o x
bit para others
:chmod o+x
EDITAR:
Finalmente consegui reproduzir. Parece que isso %0
não é suportado na <Directory>
diretiva. Eu corrigi isso adicionando um *
em vez disso:
UseCanonicalName Off
<VirtualHost *>
VirtualDocumentRoot "/home/username/Development/PHP/%0/public_html/"
<Directory "/home/username/Development/PHP/*/public_html/">
Require all granted
</Directory>
</VirtualHost>
Responder2
Não tenho certeza se <Directory>
-directive aceita %0
como parte do nome do caminho, na documentação apenas regexps são mencionados:http://httpd.apache.org/docs/current/mod/core.html#directory
Considerando que ´%0´ faz parte do módulo vhost_alias:http://httpd.apache.org/docs/current/mod/mod_vhost_alias.html
Você pode tentar mudar
<Directory "/home/username/Development/PHP/%0/public_html/">
para:
<Directory "/home/username/Development/PHP/">
e veja se é esse o caso. Você provavelmente também pode tentar com regexp/home/username/Development/PHP/*/public_html/
Responder3
cliente negado pela configuração do servidor: /home/username/Development/PHP/foo.dev.com/public_html/
Deveria ser óbvio que....
ls -la /home/username/Development/PHP/foo.dev.com/
... drwx--x--x 8 nome de usuário nome de usuário 4096 3 de abril 14:35 public_html
... o uid do Apache precisa de permissão READ no diretório (e no arquivo). Consertar:
chmod -R o+r /home/username/Development/PHP/foo.dev.com/