首页 > 代码库 > apache 的编译安装

apache 的编译安装


apache 的编译安装 技术分享


首先对压缩包解压,静茹文件夹

[root@linuxvm02 software]# ll

total 7036

drwxr-xr-x. 11 dwchaoyue dwchaoyue    4096 Jan 25  2012 httpd-2.2.22

-rw-r--r--.  1 root      root      7200529 Dec 22 21:13 httpd-2.2.22.tar.gz

[root@linuxvm02 software]# cd httpd-2.2.22

[root@linuxvm02 httpd-2.2.22]# 


apache 的安装分为以下几个步骤。

  1. root@linuxvm02 httpd-2.2.22]#./configure --prefix=/usr/local/apache --enable-so --enable-   proxy --enable-proxy-http --enable-proxy-balancer --enable-modules=all --enable-mods-      shared=all 

  2. 执行make

  3. 执行make install 

  4. chkconfig --add httpd     # 添加到系统服务

  5. chkconfig --level 345 httpd on   


查看apache服务状态

[root@linuxvm02 httpd-2.2.22]# service  httpd status  

httpd (pid  10175) is running...

[root@linuxvm02 httpd-2.2.22]# 


apache服务成功安装!


配置apache服务.

查找apache的配置文件

[root@linuxvm02 httpd-2.2.22]# updatedb  

[root@linuxvm02 httpd-2.2.22]# locate  httpd.conf

/etc/httpd/conf/httpd.conf

/etc/httpd/conf/httpd.confbak

/home/software/httpd-2.2.22/docs/conf/httpd.conf.in

/usr/local/apache/conf/httpd.conf

/usr/local/apache/conf/original/httpd.conf

[root@linuxvm02 httpd-2.2.22]# 



 /etc/httpd/conf/httpd.conf 即为apache的配置文件.

修改/etc/httpd/conf/httpd.conf 文件

[root@linuxvm02 httpd-2.2.22]# vi  /etc/httpd/conf/httpd.conf


#

# DocumentRoot: The directory out of which you will serve your

# documents. By default, all requests are taken from this directory, but

# symbolic links and aliases may be used to point to other locations.

#

DocumentRoot "/var/www/apache"


将 DocumentRoot修改为  DocumentRoot "/usr/local/apache/htdocs"


在客服端测试,直接在浏览器中输入http://ip

技术分享


apache 搭建完成,并且能正确浏览内置页面.



异常处理:

执行./configure --prefix=/usr/local/apache --enable-so 报错》

[root@linuxvm02 httpd-2.2.22]#./configure --prefix=/usr/local/apache --enable-so --enable-proxy --enable-proxy-http --enable-proxy-balancer --enable-modules=all --enable-mods-shared=all 

checking whether to enable mod_charset_lite... no

checking whether to enable mod_deflate... checking dependencies

checking for zlib location... not found

checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures


解决方法: 安装zlib-devel


[root@linuxvm02 Packages]# ll | grep  -i  zlib-devel

-r--r--r--. 211 root root    44740 Sep 26  2011 zlib-devel-1.2.3-27.el6.i686.rpm

-r--r--r--. 131 root root    44728 Sep 26  2011 zlib-devel-1.2.3-27.el6.x86_64.rpm

[root@linuxvm02 Packages]# rpm  -ivh   zlib-devel-1.2.3-27.el6.x86_64.rpm

warning: zlib-devel-1.2.3-27.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing...                ########################################### [100%]

   1:zlib-devel             ########################################### [100%]



参考链接:

http://www.jb51.net/LINUXjishu/39765.html

http://blog.sina.com.cn/s/blog_53cb817c01011a3o.html

http://www.linuxidc.com/Linux/2012-07/66029.htm

apache的配置:

http://wenku.baidu.com/view/6781e29951e79b89680226f2.html



本文出自 “SQLServer MySQL” 博客,请务必保留此出处http://dwchaoyue.blog.51cto.com/2826417/1593808

apache 的编译安装