Apache official website: http://www.apache.org/dyn/closer.cgi. Recommended use of domestic open source image address:http://mirrors.aliyun.com/apache/httpd/httpd-2.2.31.tar.bz2 or/ http mirrors.sohu.com/apache/httpd-2.2.31.tar.bz2 . The so-called Apache, the real name is httpd.
Download
[Email protected] ~]# cd/usr/local/src[[email protected] src]# wget http://mirrors.sohu.com/apache/httpd-2.2.31.tar.bz2
Extract
[Email protected] src]# tar jxvf httpd-2.2.31.tar.bz2
Configuring compilation parameters
[[email protected] src]# cd httpd-2.2.31[[email protected] httpd-2.2.31]# ./configure --prefix=/usr/local/apache2 --with-included-apr --enable-so --enable-deflate=shared --enable-expires= Shared --enable-rewrite=shared --with-pcre
--PREFIX specifies where to install,--enable-so means to enable dso,--enable-deflate=shared to compile deflate modules in a way that represents dynamic sharing, followed by the same parameters. Since there is a dynamic there is also static, what is the difference between the two? Apache compiled installation will generate a core binary executable called httpd, this file as a core file, the service is it in the processing of user requests, but some features, such as mentioned here expires is configured static file (picture) expiration time, This means that the picture can be cached in the user's browser's temporary cache directory for how long. These functions are used as an extension of the httpd, then there are two ways to do this extension module, one is directly at compile time and httpd files together, form a large file, this way is called static. The other way is that the extension module exists as a standalone file, which is shared dynamically only when the module is used to invoke it. Among them, the dynamic advantage is that the core file httpd is relatively small, the module is ready to load at any time, consuming less memory. The advantage of static is that when the service starts, it will load all the modules, the time to execute quickly, high efficiency.
./configure This step often occurs with errors:
Error:mod_deflate have been requested but can is built due to prerequisite failures[[email protected] httpd-2.2.31]# y Um install-y zlib-devel
In order to avoid errors in make, it is best to install some library files first in advance:
#yum install-y pcre pcre-devel Apr apr-devel
Compiling and installing
#make
#make Install
[[email protected] httpd-2.2.31]# makemake[4]: leaving directory '/USR/LOCAL/SRC /httpd-2.2.31/modules/mappers ' make[3]: leaving directory '/usr/local/src/httpd-2.2.31/modules/ Mappers ' make[2]: leaving directory '/usr/local/src/httpd-2.2.31/modules ' make[2]: Entering directory '/usr/local/src/httpd-2.2.31/support ' make[2]: leaving directory '/usr/ Local/src/httpd-2.2.31/support ' make[1]: leaving directory '/usr/local/src/httpd-2.2.31 ' [[Email protected] httpd-2.2.31]# echo $?0[[email protected] httpd-2.2.31]# make installmake[2]: Entering directory '/usr/local/src/httpd-2.2.31/support ' make[2]: leaving directory '/usr/local/src/httpd-2.2.31/support ' installing configuration files[ Preserving existing htdocs subdir: /usr/local/apache2/htdocs][preserving existing ERROR SUBDIR: /usr/local/apache2/error][preserving existing icons subdir: /usr/local/apache2/icons][ preserving existing cgi subdir: /usr/local/apache2/cgi-bin]installing header filesinstalling build system filesinstalling man pages and online manualmake[1]: leaving directory '/usr/local/src/httpd-2.2.31 ' [[email protected] Httpd-2.2.31]# echo $?0
Apache startup script joins system Services list
[Email protected] php-5.6.10]# Cp/usr/local/apache2/bin/apachectl/etc/init.d/httpd[[email protected] php-5.6.10]# Vim/etc/init.d/httpd
Add two lines of text below the first line #!/bin/sh
#chkconfig: 30#description:apache
Save exit
[Email protected] php-5.6.10]# chkconfig--add httpd[[email protected] php-5.6.10]# chkconfig--level + httpd on
This article is from the "Learn Notes for students" blog, please make sure to keep this source http://sanyisheng.blog.51cto.com/11154168/1795790
Lamp--2. Apache Compilation Installation