Compared to Apache 2.2.x, Apache 2.4.x offers a number of performance improvements, including support for greater traffic, better support for cloud computing, more concurrency with less memory, and more. In addition, there are performance improvements, memory utilization, asynchronous I/O support, dynamic reverse proxy settings, comparable or better performance with time-driven Web servers, more powerful processing resource allocation, more convenient cache support, and customizable high-speed servers and proxies. Other features include simpler error analysis, more flexible settings, more powerful authentication mechanisms, and more complete documentation.
The Apache Server Project Management board and the Apache Foundation chairman, Jim Jagielski, said they wanted the end user to really see performance improvements, and Apache 2.4.x was faster than many Web servers, such as Nginx.
apache-2.2 is different from the new apache-2.4 installation is that theversion 2.4 has not been brought to the Apr library, so before installing the apache-2.4, you need to download Apr.
The required source code package
Apr-1.4.6.tar.gz (available from http://apr.apache.org/download.cgi download to latest version)
Apr-util-1.4.1.tar.gz (available from http://apr.apache.org/download.cgi download to latest version)
Httpd-2.4.6.tar.gz (available from http://www.apache.org/dist/httpd/download to latest version)
Httpd-2.4.6.tar.gz (available from ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/download to latest version)
#安装 Apr
1 cd/usr/local/src/apache-2.4. 6 2 tar -xzvf./apr-1.4. 6. Tar . GZ 3 CD./apr-1.4. 6 4 mkdir /usr/local/Apr5 ./configure--prefix=/usr/local/Apr6 Make Make Install
#安装 Apr-util
1cd/usr/local/src/apache-2.4.62 Tar-XZVF./apr-util-1.4.1.Tar. GZ3CD./apr-util-1.4.14 mkdir/usr/local/apr-util5./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/bin/apr-1-Config6 Make&& Make Install
#安装 Pcre
1 cd/usr/local/src/apache-2.4 . Span style= "color: #800080;" >6 2 tar -xzvf./pcre-8.33 . tar .gz 3 CD./pcre-8.33 4 pcre 5 ./configure--prefix=/usr/local/pcre--WITH-APR=/USR/LOCAL/APR /bin/apr-1 -config 6 make install
Installing Apache2.4.6
1cd/usr/local/src/apache-2.4.62 Tar-XZVF./httpd-2.4.6.Tar. GZ3CD./httpd-2.4.64./configure--prefix=/usr/local/apache--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util--with-pcre=/ Usr/local/pcre--enable-so--enable-deflate=shared--enable-expires=shared--enable-ssl=shared--enable-headers= Shared--enable-rewrite=shared--enable-static-support--with-mpm=prefork5 Make&& Make Install
Explanation of compilation parameters:
--prefix=/usr/local/apache: Specifying the installation directory
--WITH-APR=/USR/LOCAL/APR:APR Library
--with-apr-util=/usr/local/apr-util:apr-util Library
--with-pcre=/usr/local/pcre:pcre Library
--enable-so: Allow the runtime to load the DSO module (note: The so module needs to be statically compiled)
--enable-deflate=shared: Compiling the Deflate module as DSO
--enable-expires=shared: Compiling the Expires module as DSO
--enable-ssl=shared: Compiling the SSL module to DSO
--enable-headers=shared: Compiling the Headers module as DSO
--enable-rewrite=shared: Compiling the rewrite module as DSO
--enable-static-support: Compile all binary support programs with a static connection (by default, dynamic connection)
--with-mpm=prefork: MPM using the Prefork form
More detailed explanation of compilation parameters: Http://lamp.linux.gov.cn/Apache/ApacheMenu/programs/configure.html
The installation has not been successful and the following actions are required:
1 CP./build/rpm/httpd.init/etc/init.d/httpd #使用init脚本管理httpd2 chmod 755/etc/init.d/httpd #增加执行权限3Chkconfig--Add httpd #添加httpd到服务项4Chkconfig--level2345httpd on #设置开机启动5Chkconfig--list httpd #查看是否设置成功6 7 MV/etc/httpd/etc/Httpd_old #移走旧的httpd文件夹8 LN-s/usr/local/apache/etc/httpd #建立httpd的软链接,9#到时候, the Apache configuration file path is/etc/httpd/conf/httpd.conf, in fact the true path is/usr/local/apache/conf/httpd.confTen One LN-sf/usr/local/apache/bin/httpd/usr/sbin/httpd #设置软链接以适应init脚本 A LN-sf/usr/local/apache/bin/apachectl/usr/sbin/Apachectl - - RM-rf/var/log/httpd/ the LN-s/usr/local/apache/logs/var/log/httpd - - Groupadd Apache #添加apache用户组及用户 -Useradd-g apache-s/usr/sbin/Nologin Apache + Chown-R Apache:apache/usr/local/apache
Modify the init command file
The main is to modify the value of the Pidfile parameter in the file (process file point)
1 vim/etc/init.d/httpd
Put one of the
1 Pidfile=${pidfile-/var/run/${prog}.pid}
Revision changed to
1 Pidfile=${pidfile-/usr/local/apache/logs/${prog}.pid}
Configure the firewall to turn on port 80
1 vim/etc/sysconfig/iptables
#添加如下规则到22 Ports under this rule, you can
1 -j ACCEPT
#重启防火墙
1 Service iptables Restart # or/etc/init.d/iptables restart
Launch Apache
1 Service httpd start # or/ETC/INIT.D/HTTPD start
The following issues may occur during installation:
When compiling Apache, it appears:
1 checking whether to enable Mod_ssl ... Configure:error:mod_ssl have been requested but can not is built due to Prerequisite Failures
Workaround:
1 Yum Install Openssl-devel
When you start Apache, it appears:
1 httpd:could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Workaround:
#vi/etc/httpd/conf/httpd.conf (here/etc/httpd is the directory where I installed Apache)
Find #servername www.example.com:80 to remove, and then restart Apache can be all right.
Build and install Apache under CentOS