Apache 无法自动启动,
1 、将 apachectl 文件拷贝到 /etc/rc.d/init.d 中,然后在 /etc/rc.d/rc5.d/ 下加入链接即可。
命令如下:
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd // 如果有其他的版本的 Apache 存在,也可以直接覆盖掉
ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S85httpd // 建立链接 (85 的意义后面介绍 )
此时 Apache 就可以自动启动了。
2 、 运行 chkconfig --list ,发现没有 linux 服务列表中 httpd ,通过 chkconfig --add httpd 来添加 , 但是提示: httpd 服务不支持 chkconfig 。需要编辑 /etc/rc.d/init.d/httpd, 添加以下注释信息:
# chkconfig: 345 85 15
# description: Activates/Deactivates Apache Web Server
第一行 3 个数字参数意义分别为:哪些 Linux 级别需要启动 httpd(3,4,5) ;启动序号 (85) ;关闭序号 (15) 。
保存后执行: chkconfig --add httpd, 成功添加。
在 rc3.d 、 rc4.d 、 rc5.d 路径中会出现 S85httpd 的链接文件,其他运行级别路径中会出现 K61httpd 的链接文件。
3 、运行 chkconfig --list httpd
chkconfig --add httpd
最新推荐文章于 2024-01-19 13:54:35 发布