当前为centos6下安装部署apache2.4.33版本
[APACHE]()依赖安装部署:
[下载]()httpd所需要的源码依赖包
[root@localhost ~]# wget -r http://mirrors.shu.edu.cn/apache/httpd/httpd-2.4.33.tar.gz
[root@localhost ~]# wget -r https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.6.3.tar.gz
[root@localhost ~]# wget -r https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
[root@localhost ~]# wget -r https://ftp.pcre.org/pub/pcre/pcre-8.42.tar.gz
[解压下载的源代码包]()
[root@localhost ~]# tar xf httpd-2.4.33.tar.gz -C /usr/src
[root@localhost ~]# tar xf apr-1.6.3.tar.gz -C /usr/src
[root@localhost ~]# tar xf apr-util-1.6.1.tar.gz -C /usr/src
[root@localhost ~]# tar xf pcre-8.42.tar.gz -C /usr/src
[安装]()apr、apr-util、pcre
[root@localhost ~]# cd /usr/src/apr-1.6.3
[root@localhost apr-1.6.3]# ./configure --prefix=/usr/local/apr &&make &&make install
[root@localhost yum.repos.d]# yum -y install expat-devel //安装apr-util依赖包否则报错
[root@localhost ~]# cd /usr/src/apr-util-1.6.1
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && make &&make install
[root@localhost ~]# cd /usr/src/pcre-8.42/
[root@localhost pcre-8.42]# ./configure --prefix=/usr/local/pcre &&make &&make install
[安装]()apache2.4.33
[root@localhost ~]# rpm -e httpd --nodeps //卸载系统自带HTTPD的RPM包
[root@localhost ~]# tar xf httpd-2.4.33.tar.gz -C /usr/src/
[root@localhost ~]# cd /usr/src/httpd-2.4.33/
[root@localhost httpd-2.4.33]# ./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-rewrite --enable-charset-lite --enable-cgi &&make &&make install
[root@localhost httpd-2.4.33]# ln -s /usr/local/apache/bin/* /usr/local/bin/ //优化执行路径
[root@localhost ~]# cp -r /usr/src/apr-1.6.3 /usr/src/httpd-2.4.33/srclib/apr
[root@localhost ~]# cp -r /usr/src/apr-util-1.6.1 /usr/src/httpd-2.4.33/srclib/apr-util
[root@localhost php-7.2.6]# echo -e '<?php\n phpinfo ();\n?>' > /usr/local/apache/htdocs/index.php
[root@localhost php-7.2.6]# vim /usr/local/apache/conf/httpd.conf
AddType application/x-httpd-php .php //添加一行用来支持PHP
[root@localhost php-7.2.6]# service httpd restart
[root@localhost httpd-2.4.33]# httpd -v
Server version: Apache/2.4.33 (Unix)
Server built: Jun 3 2018 03:07:00
启动服务校验