源码包安装httpd,apache

1、安排装包下载位置(如果出现报错没有apr、apr-util、pcre可以下下载如下安装包)

wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.41.tar.gz
wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.7.0.tar.gz
wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
wget https://sourceforge.net/projects/pcre/files/pcre/8.44/pcre-8.44.tar.gz

2、源码安装httpd依赖包,解决报错没有apr、apr-util、pcre

yum -y install gcc gcc-c++ make openssl openssl-devel

tar -xf apr-1.7.0.tar.gz
tar -xf apr-util-1.6.1.tar.gz
tar -xf httpd-2.4.41.tar.gz

2.1、编译安装apr
cp -r apr-1.7.0 httpd-2.4.41/srclib/apr    (有时候编译安装httpd,指定apr、apr-util会报错,可以把解压包文件拷贝到httpd解压目录下)
cp -r apr-util-1.6.1 httpd-2.4.41/srclib/apr-util

cd apr-1.7.0/
./configure --prefix=/usr/local/apr && make && make install

yum install expat-devel(解决安装apr-util报错)

2.2、编译安装apr-util
cd apr-util-1.6.1/
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && make && make install

2.3、编译安装pcre
tar -xf pcre-8.44.tar.gz
cd pcre-8.44/
./configure --prefix=/usr/local/pcre && make && make install

3、编译安装apache
cd httpd-2.4.41/
./configure --prefix=/usr/local/apache2 --with-pcre=/usr/local/pcre --with-included-apr --enable-so --enable-dav --enable-dav-fs --enable-maintainer-mode --enable-deflate=shared --enable-expires=shared --enable-headers=shared --enable-rewrite=shared --enable-static-support --with-mpm=prefork --enable-cache --enable-file-cache --enable-rewrite --enable-ssl --enable-proxy --enable-proxy-http --with-sqlite=/usr/local/sqlite/ --with-pcre=/usr/local/pcre/ && make && make install

4、修改apache配置文件,开启apache
vim /usr/local/apache2/conf/httpd.conf
ServerName www.example.com:80 (去掉注释)
/usr/local/apache2/bin/apachectl start (开启)
/usr/local/apache2/bin/apachectl stop (关闭)

 

 

posted @ 2019-08-08 16:31  背对疾风吧  阅读(279)  评论(1编辑  收藏  举报