cd /usr/local/src/

wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.2.31.tar.gz

tar zvf httpd.tar.gz

cd httpd

yum install -y gcc zlib-devel

 ./configure \

--prefix=/usr/local/apache2 \

--with-included-apr \

--enable-so \

--enable-deflate=shared \

--enable-expires=shared \

--enable-rewrite=shared \

--with-pcre

make

make install


/usr/local/apache2/bin/apachectl start|stop|restart|graceful 重新加载配置,服务不会停止

查看配置文件是否正确

/usr/local/apache2/bin/apachectl -t

httpd: Could not reliably determine the server's fully qualified domain name, using 202.102.110.203 for ServerName

Syntax OK


配置文件路径

/usr/local/apache2/conf/httpd.conf


查看静态模块

/usr/local/apache2/bin/apachectl -l 

静态模块路径,启动时已加载

du -sh /usr/local/apache2/bin/httpd


查看所有模块

/usr/local/apache2/bin/apachectl -M

动态模块路径

ls /usr/local/apache2/modules/

httpd.exp  mod_deflate.so  mod_expires.so  mod_rewrite.so


工作模式设定,版本默认区别,work prefork

./configure --help | grep mpm

  --with-mpm=MPM          Choose the process model for Apache to use.

                          MPM={beos|event|worker|prefork|mpmt_os2|winnt}