无法在 RHEL 7 上启动 httpd

无法在 RHEL 7 上启动 httpd

我无法在 RHEL 7 上启动 httpd。

[root@machine]# systemctl restart httpd
Failed to restart httpd.service: Unit not found.

我试过...

yum update -y
yum install httpd -y
systemctl restart httpd

相同的结果。 Apache 配置看起来没问题:

[root@machine]# httpd -t
Syntax OK

红帽企业 Linux 服务器版本 7.7 (Maipo)


[root@machine me]# rpm -q httpd
httpd-2.4.6-90.el7.x86_64

...

[root@machine me]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2020-01-27 15:38:54 CST; 1 day 16h ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 36851 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 36849 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 36849 (code=exited, status=1/FAILURE)

Jan 27 15:38:54 faspbsy0002 httpd[36849]: (98)Address already in use: AH0007...0
Jan 27 15:38:54 faspbsy0002 httpd[36849]: (98)Address already in use: AH0007...0
Jan 27 15:38:54 faspbsy0002 httpd[36849]: no listening sockets available, sh...n
Jan 27 15:38:54 faspbsy0002 httpd[36849]: AH00015: Unable to open logs
Jan 27 15:38:54 faspbsy0002 systemd[1]: httpd.service: main process exited, ...E
Jan 27 15:38:54 faspbsy0002 kill[36851]: kill: cannot find process ""
Jan 27 15:38:54 faspbsy0002 systemd[1]: httpd.service: control process exite...1
Jan 27 15:38:54 faspbsy0002 systemd[1]: Failed to start The Apache HTTP Server.
Jan 27 15:38:54 faspbsy0002 systemd[1]: Unit httpd.service entered failed state.
Jan 27 15:38:54 faspbsy0002 systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

答案1

在我看来,找不到单位似乎httpd没有得到适当的服务。

尝试以下操作

systemctl is-enabled httpd
systemctl is-active httpd

如果两者都再次返回unit not found,请尝试httpd再次安装,首先备份您的配置。

yum remove httpd

yum search apache
yum install httpd

答案2

问题似乎是我安装了两个不同版本的 Apache:标准版本和 Red Hat Software Collections 版本。

[root@faspbsy0002 httpd24]# yum list installed | grep httpd
httpd.x86_64                  2.4.6-90.el7             @rhel-7-server-rpms      
httpd-tools.x86_64            2.4.6-90.el7             @rhel-7-server-rpms      
httpd24-httpd.x86_64          2.4.34-7.el7.1           @rhel-server-rhscl-7-rpms
httpd24-httpd-tools.x86_64    2.4.34-7.el7.1           @rhel-server-rhscl-7-rpms
httpd24-libcurl.x86_64        7.61.1-2.el7             @rhel-server-rhscl-7-rpms
httpd24-libnghttp2.x86_64     1.7.1-7.el7              @rhel-server-rhscl-7-rpms
httpd24-mod_ssl.x86_64        1:2.4.34-7.el7.1         @rhel-server-rhscl-7-rpms
httpd24-runtime.x86_64        1.1-18.el7               @rhel-server-rhscl-7-rpms

要重新启动 Apache,我需要做...

systemctl restart httpd24-httpd

我可能还应该删除我不使用的 Apache 版本。

我还发现httpd-V在这种情况下会产生误导,因为它给出了标准 Apache 的 httpd_root 和 document_root,但这不是正在使用的 Apache。

相关内容