--------------------------------------------------安装前的工具安装-------------------------------------------------------------------
yum install -y pcpe-devel zlib-devel openssl-devel pcre-devel libxml2-devel bzip2-devel gcc gcc-c++ autoconf
---------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------软件包下载地址--------------------------------------------------------------------

http://pan.baidu.com/s/1kVh2DNp 密码:aoea

--------------------------------------------------HTTPD安装使用模块---------------------------------------------------------------
--prefix=/usr/local/httpd
--sysconfdir=/etc/httpd 默认配制文件位置-so-
--enable-so 加载动态共享模块
--enable-ssl ssl功能,hhtbs
--enable-deflate 压缩机制
--enable-proxy-fcgi fcgi模块启动
--enable-mpms--shared=MPM mpm功能,prefork,worker,event 默认event
--with-mpm=MPM MPM使用默认的MPM
--enable-rewrite 支持url重写
--enable-cgid 启用线程模式event或者worker需要启用
--------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------HTTPD组件安装--------------------------------------------------------------------
apr #tar -xvf apr-1.5.2.tar.gz
#cd apr-1.5.2
#./configure --prefix=/usr/local/apr
#make && make install
apr-util #tar -xvf apr-util-1.5.2.tar.gz
#cd apr-util-1.5.2
#./configure --prefix=/uar/local/apr-util --with-apr=/usr/local/apr
#make && make install
-----------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------HTTPD安装步骤------------------------------------------------------------------
httpd #tar httpd-2.4.27.tar.gz
#cd httpd-2.4.27
#yum -y install pcpe-devel zlib-devel openssl-devel pcre-devel
#./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-rewrite --enable-ssl --enable-deflate --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-mpma-shared=all --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
#make && make install
#vim /etc/httpd/httpd.conf
#pidfile "/var/run/httpd.pid 前边的#是注释
#vim /etc/httpd/httpd.conf
pidfile "/var/run/httpd.pid
---------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------sysV风格-------------------------------------------------------------------------------
#vim /etc/init.d/httpd
粘贴脚本
#chmod +x /etc/init.d/httpd
#service httpd restat
#chkconfig --add httpd
#chkconfig --list
#chkconfig httpd on 2345级别全on #chkconfig --level 35 httpd on
--------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------httpdctl-------------------------------------------------------------------------------

#vim /etc/profile.d/httpd.sh 加PATH
export PATH=$PATH:/usr/local/apache/bin httpd htpasswd httpdctl等命令可用
#httpd -l 列出加载模块类型 -t测试语法 -M 查看加载模块


------------------------------------------------建立虚拟主机-------------------------------------------------------------------------
#vim /etc/httpd/httpd.conf
DocumentRoot "/usr/lcoal/apache/htdocs" 注释
Include /etc/httpd/extra/httpd-vhosts.conf 启用
#vim /etc/httpd/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/usr/local/apache/htdocs"
ServerName www.doqi.con.cn1
<Directory "www.doqi.com.1">
Options none
AllowOverride none
require all granted
</directory>
ErrorLog "/var/log/httpd/error_log"
CustomLog "/var/log/httpd/access_log" combined
-----------------------------------------------压力测试----------------------------------------------------------------------------------
#/usr/local/apache/bin/ab
-c 并发量
-n 一共请求多少

--------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------HTTPD SYSV风格脚本------------------------------------------------------------
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi

HTTPD_LANG=${HTTPD_LANG-"C"}
INITLOG_ARGS=""
apachectl=/usr/local/apache/bin/apachectl
httpd=${HTTPD-/usr/local/apache/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
check13 () {
CONFFILE=/etc/httpd/httpd.conf
GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
GONE="${GONE}AccessConfig|ResourceConfig)"
if LANG=C grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
echo
echo 1>&2 " Apache 1.3 configuration directives found"
echo 1>&2 " please read /usr/share/doc/httpd-2.0.52/migration.html"
failure "Apache 1.3 config directives test"
echo
exit 1
fi
}
start() {
echo -n $"Starting $prog: "
check13 || exit 1
LANG=$HTTPD_LANG daemon $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc -d 10 $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=$?
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
killproc $httpd -HUP
RETVAL=$?
fi
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f ${pidfile} ] ; then
stop
start
fi
;;
reload)
reload
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit 1
esac
exit $RETVAL
----------------------------------------------------------------------------------------------------------------------------

 

 

posted on 2017-09-05 09:34  JasonChen1030  阅读(189)  评论(0编辑  收藏  举报