+ -
当前位置:首页 → 问答吧 → 求教,apahce DocumentRoot目录改变后出现403错误

求教,apahce DocumentRoot目录改变后出现403错误

时间:2010-06-08

来源:互联网

如题,系统是Arch linux + apche2.2.15 + php5.3.2

修改apache的配置文件httpd.conf中下面两行

<Directory "/srv/http">
DocumentRoot "/srv/http"

不管改什么都会报错,注释掉php的相关行也是一样。
错误如下:(改变目录)
Access forbidden!

You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.
Error 403
localhost
Tue Jun 8 02:10:53 2010
Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/1.0.0a DAV/2 PHP/5.3.2 with Suhosin-Patch

还有一个问题,使用虚拟目录也会出现类似的错误。

增加:(httpd.conf)
# Alias
Include conf/extra/httpd-alias.conf
文件:(/etc/httpd/conf/extra/httpd-alias.conf)
# phpmyadmin
Alias /phpmyadmin /home/angei/htdocs/phpmyadmin
注:/home/angei/htdocs/phpmyadmin这个目录已经建立。
错误如下:(于上面的不完全一样)
Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.
Error 403
localhost
Tue Jun 8 02:14:29 2010
Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/1.0.0a DAV/2 PHP/5.3.2 with Suhosin-Patch

作者: 残幽灵   发布时间: 2010-06-08

补充一下:
网上有人说是php.ini中的open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/没有把新目录加进去,加了还是同样的错误。

作者: 残幽灵   发布时间: 2010-06-08

You don't have permission to access the requested directory.

很明显,权限不够,chmod改下权限试试。

作者: c55050120   发布时间: 2010-06-08

读写权限的问题吧
看看apache用什么用户, http? www? www-data?

作者: CnkknD   发布时间: 2010-06-08

引用:
作者: CnkknD
读写权限的问题吧
看看apache用什么用户, http? www? www-data?
Arch上面用的是http

作者: 残幽灵   发布时间: 2010-06-08

很郁闷,改权限a+rwx,还是改属组http.http都无效。我直接该http.conf里的User和Group为自己的,问题解决…还好我是做开发用~

谁知道apache的目录权限怎么改,详细点的。arch默认的目录权限是:
[tuzi@archlinux ~]$ ls -l /srv
总用量 8
dr-xr-xr-x 2 root ftp 4096 2月 26 12:56 ftp
drwxr-xrwx 2 root root 4096 6月 8 02:20 http
用户,属主是root!

作者: 残幽灵   发布时间: 2010-06-08