New features and basic applications of httpd2.4

Source: Internet
Author: User

httpd-2.4:

New features:

(1) MPM support operation for the DSO mechanism, in the form of modules on-demand loading;

(2) The event MPM production environment is available;

(3) Asynchronous reading and writing mechanism;

(4) Support individual log level definitions per module and per directory;

(5) Each request related to the special configuration;

(6) An enhanced version of the expression analysis;

(7) The duration of the millisecond-level persistent connection is defined;

(8) FQDN-based virtual host is no longer required namevirutalhost instructions;

(9) new directive, allowoverridelist;

(10) Support user-defined variables;

(11) Lower memory consumption;

New module:

(1) mod_proxy_fcgi

(2) mod_proxy_scgi

(3) Mod_remoteip

CentOS 6 Compile and install httpd-2.4:

Use of httpd-2.2 in CentOS 6 relies on apr-1.4+,apr-util-1.3.9

To compile the installation steps:

(1) Install the compiled development Environment Package Group: Development tools Server Platform Development Pcre-devel

(2) Turn off http-2.2 and turn off boot to prevent overwriting this version.

[[Email protected] ~]# service httpd stopstopping httpd: [OK][[email Protec Ted] ~]# Chkconfig httpd off

(3) Compile and install apr-1.5.0 and apr-util-1.5.3

[[email protected] apr-1.5.0]# ./configure --prefix= /usr/local/apr  #apr-util relies on Apr to compile and install Apr first, and specifies a different installation path from the system default. [[email protected] apr-1.5.0]# make && make install[[email  protected] apr-1.5.0]# ls /usr/local/apr        # Program files generated after compiling the installation bin  build-1  include  lib[[email protected]  apr-util-1.5.3]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr                            #编译apr-util, because it relies on APR packets, you need to specify the APR location. [[email protected] apr-util-1.5.3]# make -j 2 && make install[ [email protected] apr-util-1.5.3]# ls /usr/local/apr-utilbin  include   lib 

(4) Compile and install httpd-2.4

[[email protected] httpd-2.4.10]# ./configure --prefix=/usr/local/apache24 -- enable-so --enable-ssl -enable-cgi --enable-rewrite --enable-modules=most -- enable-mpms-shared=all --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/ usr/local/apr-util --with-mpm=prefork    #--enable  represents an enabled feature   --with   represents a dependent package group, and does not indicate that the path will be looked up from the default path [[email protected] httpd-2.4.10]# make -j 4 & & make install[[email protected] apache24]# lltotal 56drwxr-xr-x   2 root root  4096 jan 13 20:40 bin     # Program Path drwxr-xr-x  2 root root  4096 jan 13 20:40 build     #编译安装时产生的相关文件drwxr-xr-x  2 root root  4096 jan 13  20:40 cgi-bin   #cgi格式页面存放的位置drwxr-xr-x  4 root root  4096 jan 13 20:40 conf       #配置文件drwxr-xr-x  3 root root  4096 jan 13 20:40  error     #错误页面drwxr-xr-x  2 root root  4096 jan  13 20:33 htdocs    #网页文件存放位置drwxr-xr-x  3 root root   4096 Jan 13 20:40 icons     #图标drwxr-xr-x  2 root  root  4096 Jan 13 20:40 include   #头文件, two drwxr-xr-x  used in development  2 root root  4096 Jan 13 20:40 logs       #日志drwxr-xr-x  4 root root  4096 jan 13 20:40 man        #man手册drwxr-xr-x 14 root root 12288 jul 16   2014 manual    #官方文档drwxr-xr-x  2 root root  4096 jan 13 20:40  modules   #模块

(5) Configure the environment variables for httpd-2.4 so that the system starts

[Email protected] ~]# export path=/usr/local/apache24/bin: $PATH #此种方法只对当前shell和子shell有效 [[email protected] ~]# echo $PA th/usr/local/apache24/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/ root/bin [[email protected] ~]# vim/etc/profile.d/httpd2-4.sh #为httpd-2.4 Increase the environment variable, which is valid for the newly logged-on user. Export path=/usr/local/apache24/bin/: $PATH [[email protected] conf]# apachectl start #配置完环境变量之后就能使用自带的脚本启动httpd2.4[[ Email protected] conf]# Hashhitscommand 1/usr/bin/vim 1/usr/local/apache24/bin/httpd 2/usr/local/apache24/bin/apache CTL #由此可以看出是httpd2.4 started instead of 2.2 3/bin/ls 3/USR/SBIN/SS

After the boot is complete, you can use the

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/79/A8/wKiom1aXXPjxvwm2AAApSyIBsh8659.png "title=" 1.PNG " alt= "Wkiom1axxpjxvwm2aaapsyibsh8659.png"/>


(6) But every time we use our own script to start the service too much trouble, we can copy a http2.2 service script into httpd2.4.

[[email protected] init.d]# cp httpd httpd24[[email protected] init.d]#  vim httpd24         #复制服务脚本为2.4 and edit it #if [ -f / etc/sysconfig/httpd ]; then    #注释原来的配置文件 #         . /etc/sysconfig/httpd#fiapachectl=/usr/local/apache24/bin/httpd   # Refers to the APACHECTL program for httpd2.4httpd=${httpd-/usr/sbin/httpd}prog=httpdpidfile=${pidfile-/usr/local/apache24/logs/ httpd.pid}   #此处也制定为2.4 PID Path lockfile=${lockfile-/var/lock/subsys/httpd24}       #更改为2 .4retval=0stop_timeout=${stop_timeout-10}[[email protected] init.d]# service  httpd24 start     #测试结果可以使用了Starting  httpd: [[email protected]  init.d]# service httpd24 statushttpd  (pid  35131)  is running ... [[EMAIL PROTECTED] INIT.D]# SERVICE&NBsp;httpd24 stopstopping httpd:                                              [  ok   ][[EMAIL PROTECTED] INIT.D]# SERVICE HTTPD24 STARTSTARTING HTTPD:                                               [  OK  ]


CentOS 7:

Yum Install httpd


Configuration file:

/etc/httpd/conf/httpd.conf

/etc/httpd/conf.modules.d/*.conf

/etc/httpd/conf.d/*.conf


To configure the app:

(1) Switch the MPM used

Editing a configuration file/etc/httpd/conf.modules.d/00-mpm.conf

[[email protected] ~]# vim /etc/httpd/conf.modules.d/00-mpm.conf   #  select the mpm module which should be used by uncommenting  exactly# one of the following loadmodule lines:# prefork mpm:  implements a non-threaded, pre-forking web server# see: http:// Httpd.apache.org/docs/2.4/mod/prefork.htmlloadmodule mpm_prefork_module modules/mod_mpm_prefork.so       # worker MPM: Multi-Processing Module  implementing a hybrid# multi-threaded multi-process web server# see:  http://httpd.apache.org/docs/2.4/mod/worker.html# #LoadModule  mpm_worker_module modules/mod_mpm_ worker.so        #需要开启该MPM就把原来的注释掉 # event mpm: a variant  of the worker mpm with the goal of consuming# threads only for connections with  active processing# see: http://httpd.apache.org/docs/2.4/mod/event.html# #LoadModule  mpm_ Event_module modules/mod_mpm_event.so

(2) IP-based access control: (any page in 2.4 requires explicit authorization to be accessed)

[[email protected] conf]# vim httpd.conf<directory  "/var/www/html" >            #    # possible values  for the Options directive are  "None",  "All",     #  or any combination of:    #   indexes includes  FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews    #     # Note that  "MultiViews"  must be named *explicitly*  ---  "options all"     # doesn ' t give it to you.     #    # The Options directive is both  complicated and important.  please see    # http:// Httpd.apache.org/docs/2.4/mod/core.html#options    # for more information.    #     Options Indexes FollowSymLinks    #    #  Allowoverride controls what directives may be placed in .htaccess  files.    # It can be  "All",  "None", or any  Combination of the keywords:    #   options fileinfo  AuthConfig Limit    #    AllowOverride None     #    # controls who can get stuff from  this server.    #    Require all granted                         #需要在此为根文档目录改为所有人访问      #Require  all deny                          #不允许所有主机访问      #<RequireAll>                              #表示除了指定ip不能访问. #Require  all granted  #Require  not ip 172.16.100.2    #</ requireall>                 </Directory>

To control specific IP access:

Require IP ipaddr: IP access authorized for the specified source;

Require not IP ipaddr: Deny

To control specific host access:

Require host HOSTNAME: Authorized to access the specified source of hosts;

Require not host HOSTNAME: Deny

HOSTNAME:

FQDN: Specific Host

DOMIN.TLD: Specifies the name of the

(3) Virtual host

The FQDN-based virtual host no longer requires namevirutalhost instructions;


New features and basic applications of httpd2.4

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.