May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Apache on Centos 6.6 and RHEL 6.6

CentOS compile and install httpd-2.4 and 2.4 versions of the 6.5 features introduced

httpd-2.4’s new features:

1) MPM is loaded at run-time support;
–enalbe All-mpm-shared –with-mpm = prefork = {| worker | Event}
2) Support Event mpm
3) asynchronous read and write
4) in each module and each directory separately use a different log levels
5) configure each request: <If>, <Else if>
6) Enhanced expression parser
7) millisecond keep alive the timeout
8) FQDN based virtual hosts NameVirtualHost directive is no longer needed;
9) supports user-defined variables

Additional modules :

mod_proxy_fcgi: support for ways to connect with fastcgi backend php

mode_ratelimit: speed limit, restrict user access to the transmission rate

mod_request: user requests to do more filtering

mod_remoteip: user access to IP addresses have more control

Modify some configuration mechanism :

No longer supports the use of order, allow, deny ip based access control definitions, to require

Dependencies :

Because httpd program relies on apr and apr-util so before installing httpd need to install apr and apr-util, apr yum source centos6.5 provided for httpd 1.3.9 version 1.4.0 version supports more than needed, so apr and apr-util also need to be manually installed

yum install openssl*
yum -y install arp apr-devel apr-util apr-util-devel pcre pcre-devel (Important one )
yum groupinstall ‘Development tools’
yum groupinstall ‘Server Platform Development’
wget https://archive.apache.org/dist/apr/apr-1.5.0.tar.gz
wget https://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz
wget http://mirror.nus.edu.sg/apache//httpd/httpd-2.4.12.tar.gz

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.10.tar.gz

tar zxvf apr-1.5.0.tar.gz
tar zxvf apr-util-1.5.4.tar.gz
tar zxvf httpd-2.4.12.tar.gz
tar -zxvf pcre2-10.10.tar.gz

cd /root/software/apr-1.5.0
./configure –prefix=/usr/local/apr
make && make install

[root@cluster1 apr-1.5.0]# ls /usr/local/apr/
bin build-1 include lib
[root@cluster1 apr-1.5.0]#

cd apr-util-1.5.4
./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr
make && make install

cd /root/software/pcre2-10.10
./configure –prefix=/usr/local/pcre
make && make install

[root@cluster1 httpd-2.4.12]# ls -ltr /usr/local/
total 52
drwxr-xr-x. 2 root root 4096 Sep 23 2011 src
drwxr-xr-x. 2 root root 4096 Sep 23 2011 sbin
drwxr-xr-x. 2 root root 4096 Sep 23 2011 libexec
drwxr-xr-x. 2 root root 4096 Sep 23 2011 lib64
drwxr-xr-x. 2 root root 4096 Sep 23 2011 lib
drwxr-xr-x. 2 root root 4096 Sep 23 2011 include
drwxr-xr-x. 2 root root 4096 Sep 23 2011 games
drwxr-xr-x. 2 root root 4096 Sep 23 2011 etc
drwxr-xr-x. 2 root root 4096 Sep 23 2011 bin
drwxr-xr-x. 5 root root 4096 Feb 19 19:54 share
drwxr-xr-x. 6 root root 4096 Mar 18 18:43 apr
drwxr-xr-x. 5 root root 4096 Mar 18 18:45 apr-util
drwxr-xr-x. 6 root root 4096 Mar 18 18:55 pcre

cd /root/software/httpd-2.4.12

./configure –prefix=/usr/local/apache –sysconfdir=/etc/httpd –enable-so –enable-ssl –enable-cgi –enable-rewrite –with-pcre –with-zlib –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util –enable-mpms-shared=all –with-mpm=event –enable-modules=most –enable-file-cache –enable-cache –enable-disk-cache –enable-mem-cache –enable-deflate –enable-expires –enable-headers –enable-usertrack
./configure –enable-file-cache –enable-cache –enable-disk-cache –enable-mem-cache –enable-deflate –enable-expires –enable-headers –enable-usertrack –enable-ssl –enable-cgi –enable-vhost-alias –enable-rewrite –enable-so –with-apr=/usr/local/apr/
make && make install

elinks http://localhost
It works!

 

[root@test2 httpd]# vim httpd.conf
# Server-pool management (MPM specific)
Include /etc/httpd/extra/httpd-mpm.conf
[root@cluster1 extra]# ls
httpd-autoindex.conf httpd-default.conf httpd-languages.conf httpd-mpm.conf httpd-ssl.conf httpd-vhosts.conf
httpd-dav.conf httpd-info.conf httpd-manual.conf httpd-multilang-errordoc.conf httpd-userdir.conf proxy-html.conf
[root@cluster1 extra]# cat httpd-mpm.conf
#
# Server-Pool Management (MPM specific)
#

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
# Note that this is the default PidFile for most MPMs.
#
<IfModule !mpm_netware_module>
PidFile “logs/httpd.pid”
</IfModule>

#
# Only one of the below sections will be relevant on your
# installed httpd. Use “apachectl -l” to find out the
# active mpm.
#

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxRequestWorkers: maximum number of server processes allowed to start
# MaxConnectionsPerChild: maximum number of connections a server process serves
# before terminating
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 250
MaxConnectionsPerChild 0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestWorkers: maximum number of worker threads
# MaxConnectionsPerChild: maximum number of connections a server process serves
# before terminating
<IfModule mpm_worker_module>
StartServers 3
MinSpareThreads 75
MaxSpareThreads 250
ThreadsPerChild 25
MaxRequestWorkers 400
MaxConnectionsPerChild 0
</IfModule>

# event MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestWorkers: maximum number of worker threads
# MaxConnectionsPerChild: maximum number of connections a server process serves
# before terminating
<IfModule mpm_event_module>
StartServers 3
MinSpareThreads 75
MaxSpareThreads 250
ThreadsPerChild 25
MaxRequestWorkers 400
MaxConnectionsPerChild 0
</IfModule>

# NetWare MPM
# ThreadStackSize: Stack size allocated for each worker thread
# StartThreads: Number of worker threads launched at server startup
# MinSpareThreads: Minimum number of idle threads, to handle request spikes
# MaxSpareThreads: Maximum number of idle threads
# MaxThreads: Maximum number of worker threads alive at the same time
# MaxConnectionsPerChild: Maximum number of connections a thread serves. It
# is recommended that the default value of 0 be set
# for this directive on NetWare. This will allow the
# thread to continue to service requests indefinitely.
<IfModule mpm_netware_module>
ThreadStackSize 65536
StartThreads 250
MinSpareThreads 25
MaxSpareThreads 250
MaxThreads 1000
MaxConnectionsPerChild 0
</IfModule>

# OS/2 MPM
# StartServers: Number of server processes to maintain
# MinSpareThreads: Minimum number of idle threads per process,
# to handle request spikes
# MaxSpareThreads: Maximum number of idle threads per process
# MaxConnectionsPerChild: Maximum number of connections per server process
<IfModule mpm_mpmt_os2_module>
StartServers 2
MinSpareThreads 5
MaxSpareThreads 10
MaxConnectionsPerChild 0
</IfModule>

# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxConnectionsPerChild: maximum number of connections a server process serves
<IfModule mpm_winnt_module>
ThreadsPerChild 150
MaxConnectionsPerChild 0
</IfModule>

# The maximum number of free Kbytes that every allocator is allowed
# to hold without calling free(). In threaded MPMs, every thread has its own
# allocator. When not set, or when set to zero, the threshold will be set to
# unlimited.
<IfModule !mpm_netware_module>
MaxMemFree 2048
</IfModule>
<IfModule mpm_netware_module>
MaxMemFree 100
</IfModule>
[root@cluster1 extra]#

vi httpd.conf
module is loaded

#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
LoadModule mpm_event_module modules/mod_mpm_event.so
CHECK THE MODULES LOADED

[root@cluster1 httpd]# /usr/local/apache/bin/httpd -M
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
authn_file_module (shared)
authn_core_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_core_module (shared)
access_compat_module (shared)
auth_basic_module (shared)
reqtimeout_module (shared)
filter_module (shared)
mime_module (shared)
log_config_module (shared)
env_module (shared)
headers_module (shared)
setenvif_module (shared)
version_module (shared)
mpm_event_module (shared)
unixd_module (shared)
status_module (shared)
autoindex_module (shared)
dir_module (shared)
alias_module (shared)
[root@cluster1 httpd]#

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>