Chinaunix首页 | 论坛 | 博客
  • 博客访问: 807471
  • 博文数量: 94
  • 博客积分: 1767
  • 博客等级: 上尉
  • 技术积分: 1168
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-13 23:16
个人简介

ha

文章分类

全部博文(94)

文章存档

2014年(2)

2013年(17)

2012年(6)

2011年(15)

2010年(23)

2009年(23)

2008年(8)

我的朋友

分类: 系统运维

2010-02-22 11:32:22

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

阅读(1021) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~