我在主机上安装了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/有禁止错误
1条答案
按热度按时间0mkxixxg1#
您需要向其添加以下内容:
字符串
重启Apache。
这是很多人忘记的,有些人不知道的,请大家注意这一点。
编辑
提示:运行这些命令前请备份,如果文件出现问题,我不负责。
尝试通过在终端内的morabi.app内运行
ls -la
来检查文件夹public_html的所有者,如果它不是您的用户或Apache,请尝试在目录morabi.app中运行此命令:确保你是作为你使用的主用户运行这个,我建议你不要把它改为root。
型
上面的命令将更改文件夹的所有者和其中的文件。如果将所有者更改为运行命令的用户不起作用,请将
$USER
更改为apache
,但始终要像我上面所说的那样备份。