gpt4 book ai didi

apache - Ubuntu 12.10 Forbidden - 您无权访问此服务器上的/

转载 作者:行者123 更新时间:2023-12-04 18:30:40 24 4
gpt4 key购买 nike

关闭。这个问题是off-topic .它目前不接受答案。












想改进这个问题? Update the question所以它是on-topic对于堆栈溢出。


9年前关闭。







Improve this question




我正在尝试配置我的本地服务器,就像我一直做但不工作一样,说我没有借口,但是如果我给 www 文件夹相同的权限,如果我指向这个文件夹 www if它的工作原理我不明白?

如果我这样做:它有效

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

drwxr-xr-x 2 root root 4096 nov 6 15:27 www

但如果我这样做:不起作用
DocumentRoot /home/diego/web_server
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/diego/web_server>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>


drwxr-xr-x 2 root root 4096 mar 4 15:40 web_server

我做错了吗?

最佳答案

在 Ubuntu 12.10 上的 Apache 中,您应该在/etc/apache2/envars 中有一个 envars 文件。 Web 服务器正在运行的用户:组在 envars 中设置。如果您更改 documentroot,则需要适本地设置该新文档根目录的权限。很可能在您的环境中,您的 Apache2 安装运行为 www-data:www-data。如果是这样,您需要对新的 docroot 以及将写入该目录结构的任何用户设置权限。

在/etc/apache2/apache2.conf 中,您会在文件的一半左右找到以下行。

#These need to be set in /etc/apache2/envars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

在/etc/apache2/envars 你会发现
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

您可以在 envars 中分配不同的 User:Group 或为 www-data 分配目录权限。

这与过去在 httpd.conf 中完成的方式不同。

关于apache - Ubuntu 12.10 Forbidden - 您无权访问此服务器上的/,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15212583/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com