gpt4 book ai didi

apache - 禁止 : You don't have permission to access/on this server (centos 7)

转载 作者:行者123 更新时间:2023-12-04 19:36:20 25 4
gpt4 key购买 nike

我在主机上安装了httpd,修改了httpd.conf文件如下

ServerRoot "/etc/httpd"

Listen 80


Include conf.modules.d/*.conf


User apache
Group apache

ServerAdmin root@localhost

<Directory />
AllowOverride none
Require all granted
</Directory>
DocumentRoot "/home/admin/domains/morabi.app/public_html"

<Directory "/var/www">
AllowOverride None
Require all granted
</Directory>

<Directory "/var/www/html">
Options Indexes FollowSymLinks

AllowOverride None

Require all granted
</Directory>

<IfModule dir_module>
DirectoryIndex index.html
</IfModule>

<Files ".ht*">
Require all denied
</Files>

当我在浏览器中加载我的IP地址时,它有“禁止
您无权访问此服务器上的/。”错误。并且/home/admin/domains/morabi.app 权限为 755 还加载了文件,但我的 ip http://x.x.x.x/ 有禁止错误

最佳答案

您需要在其中添加以下内容,

<Directory "/home/admin/domains/morabi.app/public_html">
# Learn more about this at https://httpd.apache.org/docs/2.4/mod/core.html#options
Options Indexes FollowSymLinks

# Learn more about this at https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride
AllowOverride All

# The solution for your error, allows your files to be served, learn more about this at https://httpd.apache.org/docs/2.4/howto/access.html
Require all granted
</Directory>

并重新启动 Apache。

这是许多人忘记的事情,有些人不知道。请注意这一点。

编辑:
在目录配置中添加了单词 public_html

另一个提示

Take a backup before running these commands, I am not responsible if anything bad happens to the files.



尝试通过运行 ls -la 检查文件夹 public_html 的所有者。在终端内的 morabi.app 中,如果不是您的用户或 apache,请尝试在 morabi.app 目录中运行此命令:

Make sure you are running this as your primary user which you use, I suggest you not to change it to root.


chown $USER:$USER public_html -R

上面的命令将更改文件夹的所有者和其中的文件。更改 $USERapache如果将所有者更改为运行命令的用户不起作用,但如我上面所说,请务必在之前进行备份。

关于apache - 禁止 : You don't have permission to access/on this server (centos 7),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59477174/

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