centos6.5下Apache 安装
1.下载apache www.apache.org找到相应的地址复制后 weget即可,也可以用下面这个
wgethttp://mirrors.cnnic.cn/apache/httpd/httpd-2.4.23.tar.gztar-xfhttpd-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
wgethttp://mirrors.cnnic.cn/apache/apr/apr-1.5.2.tar.gz./configure--prefix=/application/aprmakemakeinstallwgethttp://mirrors.cnnic.cn/apache/apr/apr-util-1.5.4.tar.gz./configure--prefix=/application/apr-util--with-apr=/application/aprmakemakeinstall
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 安装之
yuminstallzlib-devel
5.ok 装好后继续 make apache 这次没有问题了 继续 make install 至此安装完毕
6.修改/application/apache2.4.23/conf/httpd.conf
找到#ServerName去掉#更改为:ServerNamelocalhost:80
7.启动apache
/application/apache2.4.23/bin/httpd-kstart
8.测试一下
curl本机ip如果返回itworks证明apache已经可以正常运行了
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。