linux添加apache到开启启动失败提示“service httpd does not support chkconfig”的解决方法

今天在linux系统上编译apache,全部编译都是正常的,但是到了最后添加开机启动却提示错误

#chkconfig httpd on

错误代码“service httpd does not support chkconfig”

网上说的方法:

vi /etc/init.d/httpd   #编辑文件


在#!/bin/sh下面添加以下两行

#chkconfig:2345 10 90
#descrption:Activates/Deactivates Apache Web Server

这样方法不适用,我平时编译apache都会添加这两行代码。

后台找到了另外一个老教程看里面的方法就解决了。

cp build/rpm/httpd.init /etc/init.d/httpd

copy apache没编译文件的build/rpm/httpd.init来替换,再来操作chmod 755 /etc/init.d/httpd //增加执行权限

chkconfig --add httpd  #添加httpd到服务项
chkconfig  httpd on   #设置开机启动
ln -fs /usr/local/apache/ /etc/httpd
ln -fs /usr/local/apache/bin/httpd /usr/sbin/httpd
ln -fs /usr/local/apache/bin/apachectl /usr/sbin/apachectl
ln -fs /usr/local/apache/logs /var/log/httpd #设置软链接以适应init脚本

正常了。!

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://sulao.cn/post/190.html

我要评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。