如何在 ubuntu 上使目录 apache 可读 [英] How to make a directory apache readable on ubuntu

查看:22
本文介绍了如何在 ubuntu 上使目录 apache 可读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下问题:

我有一个 ubuntu 12.04 服务器,我用

I have an ubuntu 12.04 server I made a virtual host with

DocumentRoot /var/www/

一切都很好,当我用 webrowser 指向这个虚拟主机的网站时,我看到了正确的 index.html.当我查看 www 文件夹的所有者时,我看到:

Everything is fine, I see the correct index.html when I point with webrowser to the website of this virtual host. When I look to the owner of the www folder I see:

ls -l
drwxr-xr-x  2 root root 4096 Jul 10 09:07 www

现在我将 DocumentRoot 更改为

Now I change the DocumentRoot to

DocumentRoot /root/testFolder/

我将 index.html 复制到此文件夹中,使用 webrowser 指向我的域,然后收到消息您没有权限..."

I copy my index.html in this folder, point with webrowser to my domain, then I get the message "You don't have the permission..."

好的,我检查 testFolder 的所有者

Ok, I check the owner of testFolder

ls -l
drwxr-xr-x 2 root     root     4096 Jul 11 08:18 testFolder

与 www 文件夹相同.

It is the same as www folder.

好的,我下次尝试更改 testFolder 的组所有者

Ok my next try to change the group owner of testFolder

chown -R www-data:www-data /root/testFolder/

但我在浏览器中得到相同的结果:您无权访问此服务器上的/."

But I get the same result in my browser: "You don't have permission to access / on this server."

推荐答案

尝试:

chown -R apache:apache /root/testFolder/

chmod +r /root/testFolder

更新
在这种特定情况下的解决方案是将 apache 从/root 下移动到不需要 root 权限的文件夹中.

UPDATE
The solution in this specific case was to move apache from under /root into a folder that doesn't require root privileges.

这篇关于如何在 ubuntu 上使目录 apache 可读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆