apache auto start

If you compile your own apache form source,your apache will not auto start during boot time.

To enable auto start apache during boot time,you need to do sme configuration on rc.d directory.

 

Follow the steps below and apache will auto start during boot time;

 

>> GO to init.d folder

 

cd /etc/rc.d/init.d

>> Create httpd script

 
vi httpd

>> Copy and paste the code below and save the file (content below is for user who install their  apache at /usr/loacl/apache)

 

#!/bin/sh
#
# Startup script for the Apache Web Server
#
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: /usr/local/apache/bin/httpd
# pidfile: /usr/local/apache/logs/httpd.pid
# config: /usr/local/apache/conf/httpd.conf

# Source function library.
. /etc/rc.d/init.d/functions

# See how we were called.
case “$1″ in
start)
echo -n “Starting httpd: ”
daemon /usr/local/apache/bin/httpd -DSSL
echo
touch /var/lock/subsys/httpd
;;
stop)
echo -n “Shutting down http: ”
killproc httpd
echo
rm -f /var/lock/subsys/httpd
rm -f /var/run/httpd.pid
;;
status)
status httpd
;;
restart)
$0 stop
$0 start
;;
reload)
echo -n “Reloading httpd: ”
killproc httpd -HUP
echo
;;
*)
echo “Usage: $0 {start|stop|restart|reload|status}”
exit 1
esac

exit 0

>>allow httpd script to be executable

 

chmod 744 httpd

 

>>Now you need to test if this apache start up script is good,type

./httpd start

   in your shell to run the apache start up script

 

>>If you exectuable the apache start up script with no error then you can continue with the next steps.

 

>>Create symbolic link at /etc/rc.d/rc3.d folder with name S80httpd than link to /etc/rc.d/init.d/httpd

 

 
cd /etc/rc.d/rc3.d
ln -s ../init.d/httpd S80httpd

>>Your server now is ready to start apache during boot time .Please reboot your server to take immediate effect.

 

>>To check if apache will start up during boot time, type

 

ps ax | grep httpd

 at your shell right after you login with a new reboot , if it shows httpd process then you have configured your apache to start during boot time correctly

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值