apache-httpd——Linux/Mac源码安装apache-httpd

一、首先下载源码

apr-1.7.0.tar.gz
apr-util-1.6.1.tar.gz
httpd-2.4.52.tar.gz
pcre-master.zip

地址分别为:

https://httpd.apache.org/download.cgi#apache24

https://apr.apache.org/download.cgi

https://apr.apache.org/download.cgi

https://gitee.com/keke1718/pcre.git  或 https://ftp.pcre.org/pub/pcre/  

二、分别解压以上4个源码包

三、创建目标目录

mkdir /usr/local/httpd
mkdir /usr/local/apr
mkdir /usr/local/apr-util
mkdir /usr/local/pcre

四、依次进入各个源码目录,执行编译命令,如下:

因为有依赖关系,所以注意顺序

cd ../soft/apache/apr-1.7.0
./configure —prefix=/usr/local/apr
make 
make install 

cd ../soft/apache/apr-util-1.6.1 
./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/
make
make install 

cd ../soft/apache/pcre-master
./configure --prefix=/usr/local/pcre
make
make install

cd ../soft/apache/httpd-2.4.52
./configure --prefix=/usr/local/httpd -with-apr=/usr/local/apr -with-apr-util=/usr/local/apr-util -with-pcre=/usr/local/pcre/

五、编缉httpd.conf

vim /usr/local/httpd/conf/httpd.conf

DocumentRoot "/usr/local/httpd/htdocs"
<Directory "/usr/local/httpd/htdocs">

Listen 80

六、启动httpd

sudo /usr/local/httpd/bin/apachectl start

七、访问 http://localhost/,显示如下,It works!

 

 

 

 

posted @ 2022-01-04 18:16  会飞的斧头  阅读(148)  评论(0编辑  收藏  举报