apache移web目录后拒绝访问

周海汉/文

将apache的web目录由/var/www/html移到/home/zhouhh/php,结果出现下面的问题:

Forbidden

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


Apache/2.2.3 (CentOS) Server at 192.168.12.12 Port 80

查找apache说明,如下:

14.Why do I get a "Forbidden" message whenever I try to access a particular directory? This message is generally caused because either ◦The underlying file system permissions do not allow the User/Group under which Apache is running to access the necessary files; or ◦The Apache configuration has some access restrictions in place which forbid access to the files. You can determine which case applies to your situation by checking the error log. In the case where file system permission are at fault, remember that not only must the directory and files in question be readable, but also all parent directories must be at least searchable (i.e., chmod +x /directory/path) by the web server in order for the content to be accessible. -------------------------------------------------------------------------------- 15.Why do I get a "Forbidden/You don't have permission to access / on this server" message whenever I try to access my server? Search your conf/httpd.conf file for this exact string: <Files ~>. If you find it, that's your problem -- that particular <Files> container is malformed. Delete it or replace it with <Files ~ "^\.ht"> and restart your server and things should work as expected. This error appears to be caused by a problem with the version of linuxconf distributed with Redhat 6.x. It may reappear if you use linuxconf again. If you don't find this string, check out the previous question.

检查配置文件,将其改为如下:

DocumentRoot "/home/zhouhh/php" <Directory "/home/zhouhh/php"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride None # # Controls who can get stuff from this server. # Order allow,deny Allow from all </Directory> <Files ~ "^\.ht"> Order allow,deny Deny from all </Files>

问题依旧

后面发现

[zhouhh@cvttssw ~]$ ll -a
总计 22200
drwxr--r-- 14 zhouhh zhouhh 4096 06-03 15:25 .
drwxr-xr-x 9 root root 4096 04-15 16:41 ..
原来是所有网页父目录都必须有可读和可执行权限的问题

[zhouhh@cvttssw ~]$ chmod +x .
一切ok,问题解决。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值