1.下载源码包并解压
[root@xuegod13 ~]# curl -O --progress http://archive.apache.org/dist/httpd/httpd-2.4.37.tar.gz
######################################################################## 100.0%
[root@xuegod13 ~]# ll
总用量 8968
-rw-------. 1 root root 1460 4月 4 14:31 anaconda-ks.cfg
-rw-r--r-- 1 root root 9177278 5月 26 04:20 httpd-2.4.37.tar.gz
**[root@xuegod13 ~]# tar xf httpd-2.4.37.tar.gz
[root@xuegod13 ~]# cd httpd-2.4.37/
[root@xuegod13 httpd-2.4.37]# ls
ABOUT_APACHE build config.layout httpd.dsp LAYOUT Makefile.win README.cmake test
acinclude.m4 BuildAll.dsp configure httpd.mak libhttpd.dep modules README.platforms VERSIONING
Apache-apr2.dsw BuildBin.dsp configure.in httpd.spec libhttpd.dsp NOTICE ROADMAP
Apache.dsw buildconf docs include libhttpd.mak NWGNUmakefile server
apache_probes.d CHANGES emacs-style INSTALL LICENSE os srclib
ap.d CMakeLists.txt httpd.dep InstallBin.dsp Makefile.in README support**
2.安装依赖
[root@xuegod13 httpd-2.4.37]# yum install apr-util apr-util-devel apr apr-devel pcre pcre-devel zlib zlib-devel openssl openssl-devel gcc -y
2.编译安装
[root@xuegod13 httpd-2.4.37]# ./configure --prefix=/usr/local/apache2.4-xuegod --enable-so --enable-rewrite --enable-ssl --enable-mpms-shared=all --enable-deflate --enable-expires
[root@xuegod13 httpd-2.4.37]# make -j 4
说明:
--prefix=/usr/local/apache2.4-xuegod #安装路径 --enable-so #支持动态加载模块 --enable-rewrite #支持网站地址重写 --enable-ssl #支持ssl加密,比如https 443 --enable-mpms-shared=all #支持动态处理模块,all表示支持所有的 --enable-deflate #支持页面传输前进行压缩 --enable-expires #支持设置网页缓存的时间 [root@xuegod13 httpd-2.4.37]# make install