【问题标题】:How do I check the apache config for validity in Red Hat Linux?如何在 Red Hat Linux 中检查 apache 配置的有效性?
【发布时间】:2020-06-29 22:29:58
【问题描述】:

我的操作系统是 Red Hat Enterprise Linux 7。这不起作用...

# httpd -t
bash: httpd: command not found

如果有帮助,这是我运行的命令以在此框上重新启动 apache...

# systemctl restart httpd24-httpd

但这不起作用...

# httpd24-httpd -t
bash: httpd24-httpd: command not found

这也不行……

# apachectl -t
bash: apachetl: command not found

这也行不通...

# apachectl configtest
bash: apachetl: command not found

【问题讨论】:

    标签: apache rhel


    【解决方案1】:

    我知道这已经有几个月了,但最终还是到了这里。我最初遇到了同样的问题,因此我在这里。我发现新的 httpd24-httpd 的位置不在我要执行的环境路径中。虽然我可以在那里添加它,但我找到了命令位置并且能够执行。

    我是如何找到命令的:

    sudo find / -name apachectl
    

    命令的输出:

    /opt/rh/httpd24/root/usr/sbin/apachectl

    执行命令:

    sudo /opt/rh/httpd24/root/usr/sbin/apachectl
    

    原来我必须修复我的配置。

    httpd:/opt/rh/httpd24/root/etc/httpd/conf/httpd.conf 第 56 行的语法错误:/opt/rh/httpd24/root/etc/httpd/conf 第 40 行的语法错误.modules.d/00-base.conf:无法将模块/mod_http2.so 加载到服务器中:libnghttp2-httpd24.so.14:无法打开共享对象文件:没有这样的文件或目录

    这对我来说很有趣,因为我没有对这方面的配置做任何事情。

    这是我正在运行的版本。

    sudo /opt/rh/httpd24/root/usr/sbin/apachectl -v
    

    服务器版本:Apache/2.4.34 (Red Hat) 服务器建成:2020年3月17日09:34:59

    一切顺利!

    从提交给 Redhat 的旧错误中也找到了更多相关信息

    Bug 1329639

    评论 10

    scl enable httpd24 -- /opt/rh/httpd24/root/usr/sbin/apachectl configtest
    

    【讨论】:

      猜你喜欢
      • 2015-08-26
      • 2016-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-13
      • 1970-01-01
      • 2014-03-17
      • 1970-01-01
      相关资源
      最近更新 更多