The world martial arts to make out the lamp of the HTTP article (3)

Source: Internet
Author: User
Tags bz2

With the first two of the introduction I believe that we have a basic understanding of HTTP, today we say a httpd-2.4, this is Apache for the httpd-2.2 of the relatively large improvements, adding a lot of practical new features, let us take a general look.

httpd-2.4 new features:

(1) MPM supports running DOS mechanism;

(2) Support event MPM;

(3) Support asynchronous read and write;

(4) Support each module and each directory to use their respective log level;

(5) per request configuration;<if>

(6) Enhanced version of the expression parser;

(7) Support keepalive timeout of millisecond level;

(8) FQDN-based virtual host no longer requires namevirtualhost instructions;

(9) Support user-defined variables;

New module:

(1) mod_proxy_fcgi# module with PHP

(2) mod_ratelimit# limit download rate module

(3) mod_remoteip# set remote client IP

Modifying the configuration mechanism:

Use order, allow, deny to define IP-based access control is no longer supported, instead require

When compiling the installation, HTTPD relies on Apr, apr-util these two packages, where APR (Apache portable runtime) is called the Apache Portable runtime environment, this thing can be simply understood as Apache virtual machine, The role is to enable the HTTPD code to run on different operating systems. Since the APR version required by httpd-2.4 is at least 1.4 and the 1.3.9 is on my system, we need to compile the APR together and install it.

  1. Install the compilation environment

  2. [email protected] ~]# yum Groupinstall "Development tools" "Server Platform Development" Y
  3. Compile install APR, then install apr-util last install httpd, which is in order

  4. [[email protected] ~]# tar-xf apr-1.5.0.tar.bz2[[email protected] ~]# CD Apr-1.5.0[[email protected] apr-1.5.0]#./config Ure--prefix=/usr/local/apr[[email protected] apr-1.5.0]# make && make install[[email protected] ~]# tar XF apr-ut Il-1.5.3.tar.bz2[[email protected] ~]# CD Apr-util-1.5.3[[email protected] apr-util-1.5.3]#./configure--prefix=/usr/ Local/apr-util With-apr=/usr/local/apr[[email protected] apr-util-1.5.3]# make && make install
  5. Compiling and installing httpd-2.4

  6. [[Email protected] ~]# tar XF httpd-2.4.10.tar.bz2[[email protected]t ~]# cd Httpd-2.4.10[[email protected] httpd-2.4.10] #./configure help# View config options [[email protected] httpd-2.4.10]#./configure--prefix=/usr/local/apache--sysconfdir=/ Etc/httpd24--enable-so--enable-ssl--enable-cgi--enable-rewrite--with-zlib--with-pcre--with-apr=/usr/local/apr- -with-apr-util=/usr/local/apr-util/--enable-modules=most--enable-mpms-shared=all--with-mpm=prefork[[email Protected] httpd-2.4.10]# make && make install

4, httpd-2.4 compilation parameters:

--prefix: #安装路径--sysconfdir: #指定配置文件路径--enable-so: #DSO兼容, Dso=dynamic shared object, dynamically shared objects, enabling module dynamics to take effect--enable-ssl:# Support for SSL/TLS, HTTPS access required installed openssl-devel--enable-cgi: #支持CGI脚本 (default on non-threaded MPM mode)--enable-rewrite: #启用Rewrite功能, URL rewrite--enable-deflate: #支持压缩功能--with-zlib: #使用指定的zlib库, do not specify the path will automatically find--with-pcre: #使用指定的PCRE库, do not specify the path will automatically find Required installed PCRE-DEVEL--WITH-APR: #指定apr安装路径--with-apr-util: #指定apr-util installation path--enable-mpms-shared: #支持动态加载的MPM模块, Optional parameters: all--with-mpm: #设置默认启用的MPM模式, {prefork|worker|event}--enable-modules: #支持动态启用的模块, optional parameter: All,most,few,reallyall

5, post-compilation auxiliary work

[[email protected] httpd-2.4.10]# vim /etc/profile.d/httpd24.sh# Add environment variable 1 export  Path=/usr/local/apache/bin: $PATH [[email protected] httpd-2.4.10]# . /etc/profile.d/ httpd24.sh# reread environment variable script [[Email protected] httpd-2.4.10]# ln -sv /usr/local/apache/include / /usr/include/httpd24# Export Header file [[email protected] httpd-2.4.10]# vim /etc/man.config# Export Help Document 43&NBSP;MANPATH&NBSP;/USR/LOCAL/APACHE/MAN[[EMAIL&NBSP;PROTECTED]&NBSP;HTTPD-2.4.10]#&NBSP;VIM&NBSP;/ETC /rc.d/init.d/httpd24  #编写服务脚本1  #!/bin/bash2  #3  # httpd         Startup script for the Apache HTTP Server4  #5  #  chkconfig: - 85 156 # description: the apache http server  is an efficient and extensible  7 #               server implementing the current http standards.8 #  processname: httpd9 # config: /etc/httpd/conf/httpd.conf10 # config: /etc/ sysconfig/httpd11 # pidfile: /var/run/httpd/httpd.pid12  #13  ### begin init  INFO14 # Provides: httpd15 # Required-Start:  $local _fs  $remote _fs   $network   $named 16 # required-stop:  $local _fs  $remote _fs  $network 17 #  should-start: distcache18 # short-description: start and stop apache  http server19 # description: the apache http server is an  extensible server20 #  implementing the current HTTP  standards.21 ### end init info2223 # source function library.24 .  /etc/rc.d/init.d/functions2526 if [ -f /etc/sysconfig/httpd ]; then27          . /etc/sysconfig/httpd28 fi2930 # start httpd in the  c locale by default.31 httpd_lang=${httpd_lang-"C"}3233 # this will  prevent initlog from swallowing up a pass-phrase prompt if34  # mod_ssl needs a pass-phrase from the user.35 initlog_args= "" 3637 # set httpd=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use  a server38 # with the thread-based  "Worker"  mpm; be warned  that some modules may not39 # work correctly with a  Thread-based mpm; notably php will refuse to start.4041 # path  to the apachectl script, server binary, and short-form for messages.42 apachectl=/usr/local/ apache/bin/apachectl43 httpd=${httpd-/usr/local/apache/bin/httpd}44 prog=httpd45 pidfile=${ pidfile-/usr/local/apache/logs/httpd.pid}46 lockfile=${lockfile-/var/lock/subsys/httpd}47 retval=048  STOP_TIMEOUT=${STOP_TIMEOUT-10}4950 # The semantics of these two  functions differ from the way apachectl does51 # things --  Attempting to start while running is a failure, and shutdown52  # when not running is also a failure.  so we just  do it the way init scripts53 # are expected to behave  here.54 start ()  {55         echo -n $ " starting  $prog: &nbsP; " 56         lang= $HTTPD _lang daemon --pidfile=${pidfile}   $HTTPD   $OPTIONS 57         retval=$?58          echo 59         [   $RETVAL  = 0 ] && touch${lockfile} 60          return  $RETVAL  61 } 62 63 # when stopping  httpd, adelay  (Of default 10 second)  is required 64 #  Before sigkilling thehttpd parent; this gives enough time for the  65 # httpd parent to sigkillany errant children. 66 stop ()  { 67         echo -n $ "Stopping  $prog:   " 68         killproc -p ${pidfile} -d${stop_timeout}  $HTTPD  69         RETVAL=$? 70          echo 71         [  $RETVAL  = 0 ] && rm -f${lockfile} ${pidfile} 72 } 73  Reload ()  { 74     echo -n $ "reloading  $prog: "  75      if ! lang= $HTTPD _lang  $httpd   $OPTIONS  -t>&/dev/ null; then 76         retval=6 77          echo $ "not reloading due toconfiguration  Syntax error " 78         failure $" not  reloading  $httpddue &NBSp;to configuration syntax error " 79     else 80          # force lsb behaviour from killproc 81          lsb=1 killproc -p ${pidfile} $ httpd-hup 82         retval=$? 83          if [  $RETVAL  -eq 7 ]; then 84              failure $ "Httpdshutdown"  85          fi 86     fi 87      echo 88 } 89 90 # See how we were  Called. 91 case $1 in 92 start)  93          start 94         ;;  95   stop)  96         stop 97          ;;  98   status)  99         status -p  ${pidfile}  $httpd 100         retval=$?101          ;; 102   restart) 103         stop104          start105         ;; 106   condrestart|try-restart) 107         if  status -p${pidfile}  $httpd  >&/dev/null; then108                  stop109                 start110          fi111         ;; 112   force-reload|reload) 113         reload114          ;; 115  graceful|help|configtest|fullstatus) 116         $ apachectl [email protected]117         retval=$?118          ;; 119   *) 120         echo $ "Usage: $prog {start| stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|conf     igtest} "121         retval=2122 esac123124  exit  $RETVAL # In fact this script is very simple, is to put the original Httpd-2.2 the script to change the line, the content is relatively simple, we can look at the [[email protected] httpd-2.4.10]# chkconfig --add  httpd24  #添加到服务列表 [[email protected] httpd-2.4.10]# chkconfig httpd24 on      #设置开机启动, but stop the httpd-2.2.


6. httpd-2.4 configuration file

/etc/httpd24 #为编译安装时定义的目录/etc/httpd24/httpd.conf # Master Profile/etc/httpd24/extra/httpd-default.conf # Default configuration file (KeepAlive, Accessfilename etc settings)/etc/httpd24/extra/httpd-userdir.conf # User Directory Profile/etc/httpd24/extra/httpd-mpm.conf # MPM configuration file/etc/ HTTPD24/EXTRA/HTTPD-SSL.CONF # SSL Profile/etc/httpd24/extra/httpd-vhosts.conf # Virtual host configuration file/etc/httpd24/extra/ HTTPD-INFO.CONF # server-status Page configuration file


Well, we are here in this article,httpd-2.4 Configuration In fact, and 2.2 Almost, our next article is described in detail, if there are errors please point out.


This article is from the "Linuxlove" blog, make sure to keep this source http://linuxlover.blog.51cto.com/2470728/1678206

The world martial arts to make out the lamp of the HTTP article (3)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.