你不必在CentOS的Apache中的权限错误 [英] You don't have permission error in Apache in CentOS
问题描述
我已经安装在CentOS的6一切正常Apache 2.2的时候apache的文件夹在默认位置的/ var / www / html等
。然后我配置里面我的用户主文件夹的虚拟主机。之后,阿帕奇开始出现紫禁城您没有权限错误
当我试图去本地主机
或 127.0.0.1
从浏览器。
I have installed apache 2.2 in centos 6. Everything worked fine when the apache folder was at its default location /var/www/html
. Then I configured a Virtual host inside my users home folder. After that apache started showing Forbidden You don't have permission error
when I tried to go to localhost
or 127.0.0.1
from browser.
这是code,我用在httpd.conf
this is the code i used in httpd.conf
<VirtualHost *:80>
DocumentRoot "/home/anjan/workspace/mfs"
ServerName anjan-centOS
<Directory "/home/anjan/workspace/mfs">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
我也被禁用 SELinux的
在一些文章,但被白白提及。如果有人可以帮助我走出这将是更AP preciated。
I also disabled SElinux
as was mentioned in some articles but in vain. If anyone could help me out it would be much appreciated.
推荐答案
我解决了这个问题。该系统的许可插手后,我发现,在用户安键
谁是所有者的/ home /安键
已读/写/关于 /家庭/安键
但组安键
,创建时用户安键
创建没有任何权限的。
I solved the problem. After meddling with the permission of the system I found out that the user "anjan"
who is owner of /home/anjan
had read/write/execute permission on /home/anjan
but the group "anjan"
, created when user "anjan"
was created didn't have any permission at all.
ls -l /home/
显示
drwx------. 28 anjan anjan 4096 Jan 21 13:19 anjan
所以我改变了许可使用此命令
so I changed the permission with this command
chmod -R 770 /home/anjan
ls -l /home/
drwxrwx---. 28 anjan anjan 4096 Jan 21 13:19 anjan
我发现在哪个用户我的Apache从<运行href=\"http://stackoverflow.com/questions/2509334/finding-out-what-user-apache-is-running-as\">this线。它被下运行用户阿帕奇
所以我加了用户阿帕奇
到组安键
使用此命令。
so I added user "apache"
to group "anjan"
with this command.
usermod -G anjan,apache apache
这瞧了。没有更多的禁止错误。
after that voila. No more Forbidden error.
P.S。我做的一切都是root用户。
P.S. I did everything as the root user.
更新
现在看来,提供的链接被打破。 继承人的另一个。
为了安全起见(为了避免未来断开的链接),这里复制的命令。在终端类型 -
Just to be safe(to avoid future broken links), copying the command here. In terminal type -
ps axo user,group,comm | grep apache
这篇关于你不必在CentOS的Apache中的权限错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!