tar zxvf httpd-2.2.8.tar.gz
cd httpd-2.2.8
./configure --prefix=/usr/local/apache2 --enable-so --enable-vhost-alias --enable-rewrite --enable-deflate --with-mpm=worker
make
make install
cd ..
cp httpd /etc/init.d/
chmod +x /etc/init.d/httpd
chkconfig --add httpd
chkconfig --level 345 httpd on
service httpd restart
==============
httpd文件的内容:
#!/bin/bash
#Program:
# httpd
#History:
# 2007/09/18 jiyali@myce.net.cn
#
# Startup script for the Apache2.0.X Web Server
# Fixed by Comsenz - Nanu (nanu@discuz.com)
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
INITLOG_ARGS=""
apachectl=/usr/local/apache2/bin/apachectl
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
prog="httpd"
start()
{
ps -ef | grep "$prog" | grep -v "grep" | grep -v "start" > /dev/null
if [ "$?" -eq "1" ]; then
echo -n $"Starting $prog: "
daemon $httpd $OPTIONS
ret=$?
echo
[ "$ret" -eq "0" ] && touch /var/lock/subsys/httpd
return 0
else
echo "httpd running"
return 0
fi
}
stop()
{
status httpd >/dev/null >&1
ret_status=$?
if [ $ret_status -eq 2 ]; then
rm -f /var/lock/subsys/httpd /var/run/httpd.pid
echo "httpd stopped"
return 0
elif [ $ret_status -eq 3 ]; then
echo "httpd stopped"
return 0
fi
echo -n $"Stopping $prog: "
killproc $httpd
ret=$?
echo
[ "$ret" -eq "0" ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status httpd
;;
restart)
stop
sleep 2
start
;;
*)
echo $"Usage: $prog {start|stop|restart|status}"
exit 1
esac
阅读(1084) | 评论(0) | 转发(0) |