操作系統:CentOS 7
先安裝wget make
yum install -y wget make
編譯安裝Apache2.4.7的時候還要先安裝環境
yum install -y gcc gcc-c++ zlib zlib-devel expat-devel
yum install -y apr apr-util pcre-devel pcre
把apr和apr-util 的源碼包放到 apache源碼包的scrlib文件下改名apr apr-util操作系統:CentOS 7
先安裝wget make
yum install -y wget make
編譯安裝Apache2.4.7的時候還要先安裝環境
yum install -y gcc gcc-c++ zlib zlib-devel expat-devel
yum install -y apr apr-util pcre-devel pcre
環境弄好後,還有查apr apr-util的安裝路徑,方便在編譯apache時候提供支持
可以用命令 find / -name apr 查找路徑
進入apache解壓目錄httpd.2.4.27 運行命令
./configure \
--prefix=/usr/local/apache2.4.27 \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util \
--with-pcre \
--with-included-apr
--enable-deflate \
--enable-expires \
--enable-headers \
--ecable-modules=most \
--enable-so \
--with-mpm=worker \
--enable-rewrite
編譯設置成功後安裝
make && make install
安裝成功後啓動apache
/usr/local/apache2.4.27/bin/apachectl start
安裝完成後的文件位置
Installing configuration files
mkdir /usr/local/apache2/conf
mkdir /usr/local/apache2/conf/extra
mkdir /usr/local/apache2/conf/original
mkdir /usr/local/apache2/conf/original/extra
Installing HTML documents
mkdir /usr/local/apache2/htdocs
Installing error documents
mkdir /usr/local/apache2/error
Installing icons
mkdir /usr/local/apache2/icons
mkdir /usr/local/apache2/logs
Installing CGIs
mkdir /usr/local/apache2/cgi-bin
Installing header files
Installing build system files
Installing man pages and online manual
mkdir /usr/local/apache2/man
mkdir /usr/local/apache2/man/man1
mkdir /usr/local/apache2/man/man8
mkdir /usr/local/apache2/manual
make[1]: Leaving directory `/home/oldboy/tools/httpd-2.4.27'
pcre-devel下載地址
http://jaist.dl.sourceforge.net/project/pcre/pcre/8.41/pcre-8.41.tar.gz
apr下載地址
http://mirrors.hust.edu.cn/apache//apr/apr-1.6.2.tar.gz
apr-util下載地址
http://mirrors.hust.edu.cn/apache//apr/apr-util-1.6.0.tar.gz