一、Apache 2.2.8 源码安装指南
首先,前往 Apache 官方网站 https://www.apache.org 下载 Apache 2.2.8 的源代码压缩包。这一步操作简单,下载完成后直接解压即可:
#tar zxvf httpd-2.2.8.tar.gz
解压后会得到 httpd-2.2.8 目录,接着进入该目录执行配置操作:
#cd httpd-2.2.8
接下来进入配置阶段,这里有一个实用技巧——如果希望后续能够动态加载模块并启用 rewrite 功能,配置命令应如下所示:
#./configure --prefix=/usr/local/apache --enable-so --enable-module=rewrite
完成配置后,依次执行编译与安装操作:
#make
#make install
安装完毕后,建议进行测试。进入 Apache 的 bin 目录,启动服务:
#cd /usr/local/apache/bin
#./apachectl start
不过,启动时很可能出现类似以下的警告信息:
httpd: apr_sockaddr_info_get() failed for
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Thu Apr 03 09:37:41 2008] [warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter
这些提示在实际操作中很常见,特别是在 FreeBSD 系统环境下。第一个错误(Could not reliably determine...)的解决方法非常简单——只需编辑 /usr/local/apache/conf/httpd.conf 配置文件,将 ServerName 的值改为 127.0.0.1 或您自己的域名即可。第二个警告(httpready Accept Filter)是 FreeBSD 系统的特有现象,系统自带的 HTTP 过滤器会自动丢弃不完整的 HTTP 请求,若不影响正常运行,可将其忽略。
