


在Linux启动时让Apache也自动启动
现对如何让Apache随Linux启动而启动的方法做个总结,总结如下:
1 cd /etc/init.d
2 vi apache2
3 粘贴以下代码
========================================
#!/bin/sh
# deion: Apache auto start-stop .
# chkconfig: - 85 15
APACHE_HOME=/usr/local/apache2
APACHE_OWNER=root
if [ ! -f "$APACHE_HOME/bin/apachectl" ]
then
echo "Apache startup: cannot start"
exit
fi
case "$1" in
'start')
su - $APACHE_OWNER -c "$APACHE_HOME/bin/apachectl start"
;;
'stop')
su - $APACHE_OWNER -c "$APACHE_HOME/bin/apachectl stop"
;;
'restart')
su - $APACHE_OWNER -c "$APACHE_HOME/bin/apachectl restart"
;;
esac
========================================
4 chmod +x apache2
5 chkconfig --add apache2
6 chkconfig -level 345 apache2 on
7 service apache2 start 启动apache server
8 重新启动Linux,并验证Apache是否随Linux启动
如果上述操作无误,结果应该是ok的!
关键字:Linux、Apache、重新启动
新文章:
- CentOS7下图形配置网络的方法
- CentOS 7如何添加删除用户
- 如何解决centos7双系统后丢失windows启动项
- CentOS单网卡如何批量添加不同IP段
- CentOS下iconv命令的介绍
- Centos7 SSH密钥登陆及密码密钥双重验证详解
- CentOS 7.1添加删除用户的方法
- CentOS查找/扫描局域网打印机IP讲解
- CentOS7使用hostapd实现无AP模式的详解
- su命令不能切换root的解决方法
- 解决VMware下CentOS7网络重启出错
- 解决Centos7双系统后丢失windows启动项
- CentOS下如何避免文件覆盖
- CentOS7和CentOS6系统有什么不同呢
- Centos 6.6默认iptable规则详解