【安装记录】MAC上安装Apache ab
分类:
文章
•
2024-10-29 15:28:52
mac 系统上安装Apache ab
第一步 下载解压
下载Apache HTTP Server
解压下载完的包
第二步 配置安装路径
- 官方安装文档如下

- 打开终端,进入到刚刚解压完的http server目录
- 执行 ./configure (根据官方文档说明,不加prefix会有默认的路径)
-
可能你会见到如下错误,找不到APR
-
为此我们要安装一下APR (Apache Portable Runtime)和APR-Util
下载地址
APR http://mirrors.shu.edu.cn/apache//apr/apr-1.6.5.tar.gz
APR-Util http://mirrors.shu.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
http://apr.apache.org/download.cgi 界面上有提供best available version
- 安装 APR,prefix后面跟着的是你想要安装APR的路径
前提:进入到解压后的APR路径
./configure –prefix=/usr/local/apr
make
make install
- 安装 APR-Util
前提:进入到解压后的APR-Util路径,prefix后面跟着的是你想要安装APR的路径,-with-apr是指向我们安装apr的路径
./configure –prefix=/usr/local/apr-util -with-apr=/usr/local/apr/
make
make install
-
再次进入到http server的解压路径,执行下列命令,其中指定了apr和apr-util的安装路径
./configure –prefix=/usr/local/httpd/ -with-apr=/usr/local/apr -with-apr-util=/usr/local/apr-util/
-
再次遇到错误,找不到PCRE-Config

下载地址,请自行选择一个版本下载 https://ftp.pcre.org/pub/pcre/ ,切记不要下载pcre2
-
安装pcre,套路和APR类似
前提:进入到解压后的pcre路径,prefix后面跟着的是你想要安装PCRE的路径
./configure –prefix=/usr/local/pcre
make
make install
注意:报“Did not find pcre-config script”的错误,可能是因为你安装了pcre2,请重新安装pcre
-
进入到http server的解压路径,执行下列命令
前提:记得创建/usr/local/httpd/这个路径
./configure –prefix=/usr/local/httpd/ -with-apr=/usr/local/apr -with-apr-util=/usr/local/apr-util/ -with-pcre=/usr/local/pcre/
-
进入到httpd的安装目录,启动服务
cd /usr/local/httpd/bin
apachectl -k start
-
遇到“AH00558: httpd: Could not reliably determine the server’s fully qualified domain name”错误
进入到/usr/local/httpd/conf目录
编辑httpd.conf文件,搜索”#ServerName”,添加ServerName localhost:80
- 重复step9
-
在浏览器中输入localhost:80,看到以下界面就对了