-

Linux设置Apache开机启动

Linux

Linux下,如果是yum安装Apache,则会默认把服务添加进系统服务中,只需要使用chkconfig来设置开机启动就可以实现Apache开机启动。但如果编译安装Apache,则需要先把Apache添加到系统服务中心,或者直接把启动命令添加到系统启动文件中。下面雷雪松详细的讲一下编译安装Apache设置开机启动。

Linux设置Apache开机启动方法一:将apache加入到系统服务
1、将Apache启动命令复制到系统服务启动目录。
[cc lang=”php” escaped=”true”][root@LAMP LAMP]# cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd[/cc]
2、编辑/etc/init.d/httpd文件,使用chkconfig把Apache加入到系统服务。
[cc lang=”php” escaped=”true”][root@LAMP LAMP]# chkconfig –add httpd[/cc]
chkconfig –add httpd的时候出现错误:service httpd does not support chkconfig。则需要在/etc/init.d/httpd文件中加入chkconfig相关配置。
[cc lang=”php” escaped=”true”][root@LAMP LAMP]# vi /etc/init.d/httpd
#chkconfig:345 85 15
#description: Start and stops the Apache HTTP Server.[/cc]
3、使用chkconfig将Apache设置开机启动。
[cc lang=”php” escaped=”true”][root@LAMP LAMP]# chkcongfig httpd on[/cc]

Linux设置Apache开机启动方法二:将Apache开机启动脚本写入/etc/rc.d/rc.local,定义开机自动启动的程序。
1、编辑/etc/rc.d/rc.local文件,在文件底部加上Apache启动命令。

[cc lang=”php” escaped=”true”][root@LAMP LAMP]# vi /etc/rc.d/rc.local
/usr/local/httpd/bin/apachectl start。
[/cc]

来源:Linux设置Apache开机启动

4 评论 “Linux设置Apache开机启动

    手机网赚 评论:
    2019年4月13日 上午9:37

    谢谢分享

    61o 评论:
    2019年5月11日 上午1:37

    先回复,再欣赏。

    一位WordPress评论者 评论:
    2020年11月27日 上午12:52

    不限域名空间,靠谱省心,国际大牌,黑色星期五特价$2.65/月
    https://www.bluehost.com/track/zhuanxiang/?page=/special/black-friday-sale

    王者荣耀无限点券破解版下载 评论:
    2022年6月18日 下午5:59

    不错哦

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注