http://httpd.apache.org/download.cgi

httpd-2.4.29.tar.gz

#创建httpd用户
groupadd httpd
useradd -g httpd -s /sbin/nologin -M httpd tar zxvf httpd-2.4..tar.gz
cd httpd-2.4.
./configure --prefix =/usr/local/apache
make && make install

编译apache时可能会出错:
#./configure --prefix……检查编辑环境时出现:
checking for APR... no
configure: error: APR not found . Please read the documentation
解决办法:

安装 apr  apr-util  pcre

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

apr-1.6.3.tar.gz

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

apr-util-1.6.1.tar.gz

./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config
make && make install

编译apr-util时报错:make[1]: *** [xml/apr_xml.lo] Error 1

解决方法:yum -y install expat-devel

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

pcre-8.38.zip

./configure --prefix=/usr/local/pcre

make && make install

然后安装Apache:

./configure --prefix=/usr/local/apache/ --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/

make && make install

/usr/local/apr-util/lib/libaprutil-.so: undefined reference to `XML_ParserCreate'
/usr/local/apr-util/lib/libaprutil-.so: undefined reference to `XML_GetErrorCode'
/usr/local/apr-util/lib/libaprutil-.so: undefined reference to `XML_SetUserData'
/usr/local/apr-util/lib/libaprutil-.so: undefined reference to `XML_ErrorString'
/usr/local/apr-util/lib/libaprutil-.so: undefined reference to `XML_SetEntityDeclHandler'
/usr/local/apr-util/lib/libaprutil-.so: undefined reference to `XML_ParserFree'
/usr/local/apr-util/lib/libaprutil-.so: undefined reference to `XML_SetElementHandler'
/usr/local/apr-util/lib/libaprutil-.so: undefined reference to `XML_StopParser'
/usr/local/apr-util/lib/libaprutil-.so: undefined reference to `XML_Parse'
/usr/local/apr-util/lib/libaprutil-.so: undefined reference to `XML_SetCharacterDataHandler'
collect2: ld returned exit status
make[]: *** [htpasswd] Error
make[]: Leaving directory `/root/zhouw/package/httpd-2.4./support'
make[]: *** [all-recursive] Error
make[]: Leaving directory `/root/zhouw/package/httpd-2.4./support'
make: *** [all-recursive] Error

make 时上面报错,尝试用 apr-1.5.2 版本

下载地址: http://archive.apache.org/dist/apr/

wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz

wget http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz

安装方法与上面 1.6版本一样,果然成功了。应该是 CentOS7 才支持 apr-1.6 版本。

安装完成后,切到安装目录,/usr/local/apache

# vim conf/httpd.conf  #配置“Listen”和“ServerName”属性;

Listen 80

ServerName localhost

# ./bin/apachectl configtest

Syntax OK

# 启动httpd

/usr/local/apache/bin/apachectl start | stop | restart

或者:

cp /usr/local/apache/bin/apachectl /etc/init.d/httpd

/etc/init.d/httpd start

最新文章

  1. JVM之方法区
  2. android wifi P2P CONNECT, INVITE和JOIN流程选择
  3. 数据库备份与还原SQL代码
  4. mysql 远程连接速度慢的解决方案
  5. Python爬取百度贴吧图片
  6. 异常处理与MiniDump详解(转)
  7. 灯笼Lantern下载及使用教程
  8. jQuery—一些常见方法(2)DOM操作【insertBefore(),insertAfter(),appendTo(),prependTo(),before(),after(),append(),prepend(),remove(),on(),off(),scrollTop()】
  9. PLSQL developer连接不上64位Oracle的解决方法
  10. SSAS属性中更改AllowedBrowsingFolders的值后才能更改其它文件夹的值
  11. 从壹开始前后端分离[.netCore 不定期 ] 36 ║解决JWT自定义中间件授权过期问题
  12. js实现图片变化
  13. pwnable.kr-fd-witeup
  14. Android开发之漫漫长途 Ⅶ——Android消息机制(Looper Handler MessageQueue Message)
  15. STM32 Flash 永久用户数据空间
  16. Perl Spreadsheet::WriteExcel 模块自动生成excel 文件
  17. 详解javascript实现自定义事件
  18. Hadoop学习之路(十八)MapReduce框架Combiner分区
  19. Log4net 配置实例
  20. [学习笔记]Segment Tree Beats!九老师线段树

热门文章

  1. P3715 [BJOI2017]魔法咒语
  2. 重新实践c++primer上面的代码
  3. POJ1743 Musical Theme —— 后缀数组 重复出现且不重叠的最长子串
  4. adaptiveThreshold自适应二值化源码分析
  5. 【HDU 3487】Play with Chain Splay
  6. unicode和utf-8互转
  7. 闪回之 Flashback Query (dml表、过程、函数、包等)、Flashback version Query
  8. BZOJ3648:寝室管理
  9. 如何让Surface RT支持网站的flash
  10. C# 对象间的 深拷贝 实现