Apache 403 错误,(13)权限被拒绝:访问/被拒绝,Fedora 16
我刚刚在 Fedora 16 上设置了 apache。但我无法让我的虚拟主机工作!
虽然 localhost/phpmyadmin 工作正常..
我在我的 httpd.conf 中得到了这个,
<Directory /home/renat/www>
AllowOverride All
Options +Indexes +FollowSymLinks
Order allow,deny
Allow from all
</Directory>
NameVirtualHost *:80
<VirtualHost *:80>
ServerName fabbro.fm
DocumentRoot /home/renat/www/fabbro
</VirtualHost>
权限也很好:
ls -l
drwxr-xr-x. 32 renat renat 4096 янв. 7 16:12 www
并且当尝试访问 fabbro.fm 时出现 403 错误 error_log 说:
[client 127.0.0.1] (13)Permission denied: access to / denied
我该怎么办?
I've just set up apache on my Fedora 16. And i can't get my vhosts working!
Though localhost/phpmyadmin works fine..
I got this in my httpd.conf
<Directory /home/renat/www>
AllowOverride All
Options +Indexes +FollowSymLinks
Order allow,deny
Allow from all
</Directory>
NameVirtualHost *:80
<VirtualHost *:80>
ServerName fabbro.fm
DocumentRoot /home/renat/www/fabbro
</VirtualHost>
Everything is fine with permissions too:
ls -l
drwxr-xr-x. 32 renat renat 4096 янв. 7 16:12 www
And i've got 403 error when try to access fabbro.fm
error_log says:
[client 127.0.0.1] (13)Permission denied: access to / denied
What do i have to do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我解决了这个问题!
由于 SELinux 安全设置,Apache 无法访问这些目录。
我所要做的就是将此命令应用于文档根路径中的目录:
I solved this problem!
Apache could not access those directories because of the SELinux security settings.
All i had to do is to apply this command to the directory in the path to document root:
我遇到了 SELinux 问题。我首先尝试了 chcon -t httpd_sys_content_t ,但这并没有解决问题。之后我做了
setsebool -P httpd_read_user_content 1
并且它起作用了。我不知道第一个命令是必要的还是仅第二个命令是必要的。I had a SELinux issue. I first tried
chcon -t httpd_sys_content_t
but that didn't fix it. After that I didsetsebool -P httpd_read_user_content 1
and it worked. I don't know if the first command was necessary or only the second.这行:
让我认为某处存在配置错误 - 例如第二个
VirtualHost
或全局DocumentRoot
定义。第二个定义以某种方式将
DocumentRoot
设置为系统根目录。阿帕奇否认这一点是正确的。您需要找到导致此问题的定义并将其删除。
This line:
makes me think there is a misconfiguration somewhere - a second
VirtualHost
for example, or a globalDocumentRoot
definition.That second definition is somehow setting
DocumentRoot
to the system's root directory. Apache is right to deny that.You need to find the definition that is causing this, and remove it.
我必须运行以下命令才能使其正常工作。前面提到的 chcon 和 setebool 没有帮助。
顺便说一句,这是在 Fedora 版本 20 (Heisenbug) 上。
I had to run the following to make it work. chcon and setsebool mentioned earlier did not help.
This is on Fedora release 20 (Heisenbug), btw.