如何在 ubuntu 上使目录 apache 可读

编程入门 行业动态 更新时间:2024-10-26 16:24:08
本文介绍了如何在 ubuntu 上使目录 apache 可读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

以下问题:

我有一个 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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-29 08:05:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1186765.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可读   目录   如何在   ubuntu   apache

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!