Httpd2.4 Introduction and CenOS6.6 under compilation and installation

Source: Internet
Author: User
Tags install openssl

CentOS7has been provided in the imagehttpd2.4of therpmPackage,httpd2.4relative tohttpd2.2There is a big improvement inCentOS6only through theApacheThe official website provides the source code package to compile the installation.


httpd2.4 new features:

MPM Support Run DOS mechanism;

Support Event MPM ;

Support asynchronous read and write;

Support each module and each directory to use the respective log level;

per request configuration; <If>

Enhanced version of the expression parser;

support for millisecond-level keepalive Timeout ;

based on FQDN virtual hosts are no longer required Namevirtualhost directive;

Support user-defined variables;


New module:

mod_proxy_fcgi# with the PHP combination of modules;

mod_ratelimit# a module that restricts the download rate;

mod_remoteip# setting up a remote client IP ;


Modifying the configuration mechanism: no longer supports the use of order,allow, deny todefine IP- based access control, instead of require;


Compile and install Httpd2.4:

httpd2.4 depends on Apr and apr-util,1.4 above, so need to compile and install together;

Apr:apacheportableruntime,Apache Portable runtime;

Official website: apr.apache.org


Lab Environment:

System version: CentOS 6.6x86_64;

httpd Source Package:httpd-2.4.16.tar.bz2;

Apr Source Package:apr-1.5.2.tar.bz2;

Apr-util Source Package:apr-util-1.5.4.tar.bz2


Experimental Prerequisites:

turn off the firewall and SELinux;

Install the compilation environment;

# yum Groupinstall "Server Platform Development" "Developmenttools"


Experimental process:

First, installation services;

Apr:

# Tar XF apr-1.5.2.tar.bz2# cd apr-1.5.2#./configure--prefix=/usr/local/apr# make && make install


Apr-util:

# Tar XF apr-util-1.5.4.tar.bz2# cd apr-util-1.5.4#./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr /--with-apr=/usr/local/apr/: Specify Apr installation location; # make && make install


httpd:

# Tar XF httpd-2.4.16.tar.bz2# cd httpd-2.4.16#./configure--prefix=/usr/local/apache--sysconfdir=/etc/httpd-- 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=all--enable-mpms-shared=all--with-mpm=event# make && Make install


HTTPD Compilation parameter explanation:

--prefix=/usr/local/apache: Installation location;--sysconfdir=/etc/httpd: Configuration file location;--ENABLE-SO: Support DSO dynamic loading module;--ENABLE-SSL: Support ssl/ TLS, can implement HTTPS protocol access, need to install OPENSSL-DEVEL;--ENABLE-CGI: support CGI script;--enable-rewrite: support URL rewrite;--with-zlib: Use the specified zlib compression library, do not specify a path The path will be automatically searched;--with-pcre: Enhanced Regular expression analysis tool using the specified pcre library; Do not specify paths will automatically look for required installed PCRE-DEVEL;--WITH-APR=/USR/LOCAL/APR: Specify the dependent APR program installation location ;--with-apr-util=/usr/local/apr-util: Specifies the installation location of the dependent Apr-util program;--enable-modules=all: Supports dynamic enable module; All: Everything, most: common ;--enable-mpms-shared=all: Compile and Share module;--with-mpm=event: module enabled by default; {prefork|worker|event}


Second, the parameter configuration;

Next is the configuration of the parameters after the installation is complete;

Add environment variables and reread the files:

# vim/etc/profile.d/httpd.sh> Export path=/usr/local/apache/bin: $PATH # source/etc/profile.d/httpd.sh


Export header file;

# LN-SV/USR/LOCAL/APACHE/INCLUDE/USR/INCLUDE/HTTPD


Export man manual;

# vim/etc/man.config> Manpath/usr/local/apache/man


Start the service and view the listening port;

# Apachectl start# SS–TNL

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/71/13/wKioL1XExnbDSx_qAAA-bjniqII052.jpg "title=" 1.jpg " alt= "Wkiol1xexnbdsx_qaaa-bjniqii052.jpg"/>


Access testing;

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/71/17/wKiom1XExInDDgtoAABW4wNVlT0380.jpg "title=" 2.jpg " alt= "Wkiom1xexinddgtoaabw4wnvlt0380.jpg"/>


To provide a service script:

you can use the script modifications provided with the RPM package installation:

# vim /etc/rc.d/init.d/httpd> #!/bin/bash> #> # httpdstartup  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>>  # sourcefunction library.> ./etc/rc.d/init.d/functions>> if [ -f/ Etc/sysconfig/httpd ]; then>     . /etc/sysconfig/httpd> fi >> # starthttpd in the c locale by default.> httpd_lang= ${httpd_lang-"C"}>> #&nbsP this willprevent initlog from swallowing up a pass-phrase prompt  If> # mod_sslneeds a pass-phrase from the user.> initlog_args= "" >> # sethttpd=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a  server> # with thethread-based  "Worker"  mpm; be warned that  some modules may not> # workcorrectly with a thread-based  mpm; notably php will refuse to start.>> # path tothe  apachectl script, server binary, and short-form for messages.>  apachectl=/usr/local/apache/bin/apachectl> httpd=${HTTPD-/usr/local/apache/bin/httpd}>  Prog=httpd> pidfile=${pidfile-/usr/local/apache/logs/httpd.pid}> lockfile=${lockfile-/var/lock /subsys/httpd}>&nbsp Retval=0>> start ()  {>     echo -n $ "Starting  $prog:   ">     lang= $HTTPD _lang daemon --pidfile=${pidfile} $httpd  $ options>     retval=$?>     echo>      [  $RETVAL  = 0 ] && touch${lockfile}>      return  $RETVAL > }> stop ()  {>     echo - n $ "stopping  $prog: " >     killproc -p ${pidfile} -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 dueto configuration syntax err or" >      failure $ "not reloading$httpd due to configuration >syntax  Error ">     else>     killproc -p ${pidfile}   $HTTPD-hup>     retval=$?>     fi>      echo> }>> # See how wewere called.>  Case "$"  in> start) >     start> ;; > stop) >     stop> ;; > status) >     status -p ${pidfile}  $httpd >     RETVAL=$?> ;; > restart) >     stop>     start> ;; > condrestart) >     if [ -f ${pidfile} ] ;  then>     stop>     start>      fi> ;; > reload) >     reload> ;; > graceful|help|configtest|fullstatus) >      $apachectl  [email  protected]>     retval=$?> ;; > *) > echo $ "usage:  $prog {start|stop|restart|condrestart|reload|status|fullstatus| Graceful|help|configtest} "> exit 1> esac>> exit  $RETVAL


Modify the master configuration file to specify pidfile;

# vim/etc/httpd/httpd.conf> Pidfile "/var/run/httpd.pid"


Script execution permissions;

# chmod +X/ETC/RC.D/INIT.D/HTTPD


Add services, test scripts;

# chkconfig httpd–add# chkconfig httpd on
# service httpd stop# service httpd start# service httpd restart# service httpd Reload

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/71/17/wKiom1XExtiC2DljAADS_-o2Q9Y072.jpg "title=" 3.jpg " alt= "Wkiom1xextic2dljaads_-o2q9y072.jpg"/>


httpd2.4 configuration file:

#/etc/httpd24: Compile the configuration file directory specified at the time of installation; #/etc/httpd24/httpd.conf: Master Profile #/etc/httpd24/extra/httpd-default.conf: Default profile, Ke    Epalive, Accessfilename and other settings; #/etc/httpd24/extra/httpd-userdir.conf: User directory profile; #/etc/httpd24/extra/httpd-mpm.conf    : mpm config file; #/etc/httpd24/extra/httpd-ssl.conf:ssl config file, providing HTTPS protocol for site; #/etc/httpd24/extra/httpd-vhosts.conf : Virtual host configuration file; #/etc/httpd24/extra/httpd-info.conf:server-status page configuration file;


At this point, the httpd2.4 installation configuration is complete andthe httpd2.4 configuration is roughly the same as httpd2.2 .

This article is from the "Pony Learning Record" blog, make sure to keep this source http://masachencer.blog.51cto.com/8683770/1682809

Httpd2.4 Introduction and CenOS6.6 under compilation and installation

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.