码迷,mamicode.com
首页 > Web开发 > 详细

centos6.5下Apache 安装

时间:2016-12-11 23:39:01      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:安装   服务器   apache   

1.下载apache  www.apache.org 找到相应的地址复制后 weget即可,也可以用下面这个


wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.23.tar.gz
tar -xf httpd-2.4.23.tar.gz
./configure 
--prefix=/application/apache2.4.23
--enable-deflate 
--enable-expires
--enable-header 
--enable-modules=most 
--enable-rewrite
--enable-so
--with-mpm=worker

解释一下上面的参数:

--prefix 安装路径

--enable-modules=most 使用大部分常用模块

--enable-rewrite 重写模块

--with-mpm=work 运行方式为一个主进程若干个子线程,还可以配置为进程,配置为进程的优点是更稳定,但是同时也更慢,更耗费cpu资源,当前主流都是把apache作为静态服务器使用所以使用work就可以了。如果你要和php等程序做配合可以设置为进程方式工作。


2.进行到这一步的时候出现了错误提示找不到apr,逐回到apache.org下载 apr和apr-util


wget http://mirrors.cnnic.cn/apache/apr/apr-1.5.2.tar.gz

./configure --prefix=/application/apr
make
make install

wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.5.4.tar.gz 

./configure --prefix=/application/apr-util --with-apr=/application/apr
make
make install


3.重新安装apache,进入apache解压缩目录


./configure 
--prefix=/application/apache2.4.23
--enable-deflate 
--enable-expires
--enable-header 
--enable-modules=most 
--enable-rewrite
--enable-so
--with-mpm=worker
--with-apr=/application/apr --with-apr-util=/application/apr-util


4.继续报错

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

这是因为没有安装zlib包,逐 yum 安装之

yum install zlib-devel


5.ok 装好后继续 make apache 这次没有问题了 继续 make install 至此安装完毕


6.修改/application/apache2.4.23/conf/httpd.conf 

找到#ServerName
去掉# 更改为: 
ServerName localhost:80

7.启动apache

/application/apache2.4.23/bin/httpd -k start


8.测试一下

curl 本机ip 如果 返回 it works 证明apache已经可以正常运行了


本文出自 “12131629” 博客,请务必保留此出处http://12141629.blog.51cto.com/12131629/1881734

centos6.5下Apache 安装

标签:安装   服务器   apache   

原文地址:http://12141629.blog.51cto.com/12131629/1881734

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!