当前位置: 代码迷 >> 综合 >> 解决Apache命令systemctl status httpd.service报错Unit httpd.service could not be found
  详细解决方案

解决Apache命令systemctl status httpd.service报错Unit httpd.service could not be found

热度:95   发布时间:2023-09-06 21:26:07.0

解决Apache命令systemctl status httpd.service报错Unit httpd.service could not be found

报错原因,Apache安装是编译安装,安装路径不是默认路径,Apache服务没有添加到Linux服务中

解决办法,将Apache服务添加到Linux系统服务中

1、找到Apache安装路径 find / -name httpd,这是我已经将Apache服务添加到Linux系统服务中,所以出现第一个路径/etc/rc.d/init.d/httpd

解决Apache命令systemctl status httpd.service报错Unit httpd.service could not be found

2、将/home/apache2.4/bin/apachectl拷贝至/etc/rc.d/init.d目录下,并且命名为httpd

解决Apache命令systemctl status httpd.service报错Unit httpd.service could not be found

3、在相应的启动级别如3,5中加入链接

解决Apache命令systemctl status httpd.service报错Unit httpd.service could not be found

4、修改配置文件httpd,在#!/bin/sh下面添加两行

解决Apache命令systemctl status httpd.service报错Unit httpd.service could not be found

解决Apache命令systemctl status httpd.service报错Unit httpd.service could not be found

解决Apache命令systemctl status httpd.service报错Unit httpd.service could not be found

5、保存后执行chkconfig --add httpd

解决Apache命令systemctl status httpd.service报错Unit httpd.service could not be found

6、查询系统服务chkconfig --list 就可以看到httpd服务了

解决Apache命令systemctl status httpd.service报错Unit httpd.service could not be found

7、家目录下执行命令systemctl status httpd.service

解决Apache命令systemctl status httpd.service报错Unit httpd.service could not be found

  相关解决方案