【发布时间】:2020-12-22 19:07:49
【问题描述】:
我以前从未遇到过这个问题,但是在这个全新安装的 CentOS 8 和 apache 2.4 中,我试图在 /etc/httpd/conf.d/ 的 vhost.conf 文件中添加新的虚拟主机,如下所示
<VirtualHost *:80>
ServerName db.example.com
ServerAlias db.example.com
DocumentRoot /usr/share/mysite
<Directory /usr/share/mysite>
Options -Indexes +FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
我测试了配置 #apachectl 配置测试
语法正常
但是当它出现在 conf.d 中时,服务器会抛出 HTTP 500 错误。当我删除此文件并重新启动服务器时,会显示欢迎页面。
我完全迷路了,请帮助
【问题讨论】:
-
error_log.txt 说明了什么?它位于 /var/log/httpd/
-
error_log 中没有此日志
-
那访问日志呢?还可以尝试将文件 hello.txt 放在 /usr/share/mysite/ 中,然后请求 db.example.com/hello.txt - 如果仍然失败,请在访问和错误日志中查找文本 hello.txt。另外:您确定 apache 具有对 /usr/share/mysite 的读取权限吗?另外:这可能是一个 selinux 问题。尝试暂时禁用 selinux 看看是否能解决问题。
标签: apache http http-status-code-500 centos8