新模块:
(1) mod_proxy_fcgi
(2) mod_proxy_scgi
(3) mod_remoteip CentOS 6编译安装httpd-2.4:
在CentOS 6中使用httpd-2.2依赖于apr-1.4+,apr-util-1.3.9
编译安装步骤:
(1)安装编译开发环境包组: Development tools Server Platform Development pcre-devel
(2)关闭http-2.2并关闭开机启动,防止覆盖此版本。
1
2
3
[iyunv@Tzz ~]# service httpd stop
Stopping httpd: [ OK ]
[iyunv@Tzz ~]# chkconfig httpd off
(3)编译安装apr-1.5.0和apr-util-1.5.3
1
2
3
4
5
6
7
8
9
[iyunv@Tzz apr-1.5.0]# ./configure --prefix=/usr/local/apr #apr-util依赖于apr所先编译安装apr,并指定一个不同与系统默认的安装路径。
[iyunv@Tzz apr-1.5.0]# make && make install
[iyunv@Tzz apr-1.5.0]# ls /usr/local/apr #编译安装后生成的程序文件
bin build-1 include lib
[iyunv@Tzz apr-util-1.5.3]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr #编译apr-util,因为依赖于apr包,所以需要指定apr位置。
[iyunv@Tzz apr-util-1.5.3]# make -j 2 && make install
[iyunv@Tzz apr-util-1.5.3]# ls /usr/local/apr-util
bin include lib
[iyunv@Tzz init.d]# service httpd24 start #测试结果可以使用了
Starting httpd:
[iyunv@Tzz init.d]# service httpd24 status
httpd (pid 35131) is running...
[iyunv@Tzz init.d]# service httpd24 stop
Stopping httpd: [ OK ]
[iyunv@Tzz init.d]# service httpd24 start
Starting httpd: [ OK ]
# 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
[iyunv@localhost 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>
控制特定的IP访问:
Require ip IPADDR:授权指定来源的IP访问;
Require not ip IPADDR:拒绝
控制特定的主机访问:
Require host HOSTNAME:授权指定来源的主机访问;
Require not host HOSTNAME:拒绝