Centos 6.3 源码编译安装 apache

系统版本 :Centos 6.3 X86

Apache   : httpd-2.4.9

源码编译安装httpd-2.4.9

下载并解压依赖包apr-1.5.1、apr-util-1.5.3

wget http://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.5.1.tar.gz
wget http://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.5.3.tar.gz
tar -zxf apr-1.5.1.tar.gz
tar -zxf apr-util-1.5.3.tar.gz

下载并解压httpd-2.4.9

wget http://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.9.tar.gz
tar -zxf httpd-2.4.9.tar.gz


移动apr-1.5.1、apr-util-1.5.3到httpd-2.4.9的srclib目录下

mv apr-1.5.1 httpd-2.4.9/srclib/apr
mv apr-util-1.5.3 httpd-2.4.9/srclib/apr-util

编译httpd-2.4.9 

cd httpd-2.4.9
./configure --prefix=/home/apache

 --enable-s 是httpd支持动态加载模块功能  --enable-rewrite 是httpd有网页地址重写功能

make && make install

注:编译中如果出现错误,可下载安装依赖库 pcre 和 zlib


进到apache/bin 目录下, 运行 ./apachectl start 

报错:AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.163.10.183. Set the 'ServerName' directive globally to suppress this message

解决方法: vi apache/conf/httpd.conf

找到    ServerName ******:80   一行,修改为    ServerName localhost:80 保存,ok,再执行 apache/bin/apachectl start    apache服务器正常启动


启动apache服务:   /home/apache/bin/apachectl start

停止apache服务:   /home/apache/bin/apachectl stop

加入系统开机自启动: echo "/home/apache/bin/apachectl start" >> /etc/rc.loacl

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章