1、Centos7系统下实现httpd-2.2的安装,并分别实现prefork、worker、event等几种工作方式
MPM
编译过程复习
三种模式转换
附上编译过程脚本
编译脚本
#!/bin/bash # # ----------------------------------- pre install scripts ----------------------------------------- wkdir=$PWD yum -y groupinstall "Development Tools" yum -y install zlib-devel which wget || yum -y install wget [ -f httpd-2.2.34.tar.gz ] || wget http://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.2.34.tar.gz # ----------------------------------- complie scripts ----------------------------------------- for i in prefork event worker; do [ -d /usr/local/httpd22-$i ] && continue [ -d httpd-2.2.34-$i ] || tar xf httpd-2.2.34.tar.gz mv httpd-2.2.34 httpd-2.2.34-$i cd httpd-2.2.34-$i ./configure --prefix=/usr/local/httpd22-$i --enable-modules=all --with-mpm=$i make -j 8 make install sleep 5 cd $wkdir rm -rf httpd-2.2.34-$i done # ----------------------------------- post install scripts ----------------------------------------- [ -L /usr/sbin/httpd.worker ] || ln -sv /usr/local/httpd22-worker/bin/httpd /usr/sbin/httpd.worker [ -L /usr/sbin/httpd.event ] || ln -sv /usr/local/httpd22-event/bin/httpd /usr/sbin/httpd.event [ -h /usr/sbin/httpd ] || ln -sv /usr/local/httpd22-prefork/bin/httpd /usr/sbin/httpd install ${wkdir}/httpd /etc/rc.d/init.d/httpd cp ${wkdir}/httpd-sys /etc/sysconfig/httpd chkconfig --list | grep 'httpd' || chkconfig --add httpd
服务脚本
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible \
# server implementing the current HTTP standards.
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
prog=${HTTPD-/usr/sbin/httpd}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
prog=$(basename $prog)
check_prog() {
[ -f $lockfile ] && RETVAL=0 || RETVAL=1
return $RETVAL
}
pxr_start() {
check_prog
if [ $RETVAL -eq 0 ]; then
echo "$prog is started."
else
#$prog $OPTIONS -DFOREGROUND
$prog $OPTIONS
if [ $? -eq 0 ]; then
touch $lockfile
echo "$prog start ok"
else
echo "$prog start fail"
fi
fi
}
pxr_stop() {
check_prog
if [ $RETVAL -eq 0 ]; then
kill -9 `pgrep $prog` &> /dev/null
rm -f $lockfile
[ $? -eq 0 ] && echo "$prog stop finished." || echo "$prog stop fail."
else
echo "$prog is stopped."
fi
}
pxr_restart() {
pxr_stop
pxr_start
}
pxr_status() {
check_prog
[ $? -eq 0 ] && echo "$prog is running." || echo "$prog is stopping"
}
case "$1" in
start|stop|restart|status)
pxr_$1
;;
*)
echo $"Usage: $prog {start|stop|restart|status}"
RETVAL=2
;;
esac
exit $RETVAL
# 注意:脚本有缺陷,要更换MPM时, 需要先停止服务....
2、简述request报文请求方法和状态响应码
request报文请求方法
状态响应码
3、详细描述httpd虚拟主机、站点访问控制、基于用户的访问控制、持久链接等应用配置实例
实现环境
一、httpd虚拟主机
(1) 基于IP的虚拟主机(httpd-2.4)
(2) 基于PORT的虚拟主机(httpd-2.4)
(3) 基于Host:(httpd-2.2/httpd-2.4)
二、站点访问控制
三、基于用户的访问控制
四、持久链接
注:完成作业路径:四 -> 二 -> 一 -> 三;参考:http://www.178linux.com/89108
本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/91448
评论列表(1条)
赞,总结的比较全面,也有自己的理解,加油~