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

搭建Apache服务

时间:2016-04-13 11:00:43      阅读:228      评论:0      收藏:0      [点我收藏+]

标签:

Apache安装包
 
安装依赖项目
APR和APR-util
 
安装pcre库
官网地址: http://www.pcre.org/

centos安装apache

=======开始========

在安装Apache的httpd的时候经常会遇到:
configure: error: APR not found .  Please read the documentation.
configure: error: APR-util not found .  Please read the documentation.
configure: error: pcre-config for libpcre not found. PCRE is required and available 
网上也有文章指导如何下载后安装这些依赖的文件,本文
将这些依赖的文件都打包在http://download.csdn.net/detail/kkdelta/4424852.
将下面所有文件都放在 /root/wkr目录
apr-1.4.6.tar.gz
apr-util-1.4.1.tar.gz
httpd-2.4.2.tar.gz
pcre-8.30.zip

1,安装APR:
tar -zxvf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure
make
make install
2,安装APR-UTIL
#tar -zxvf apr-util-1.4.1.tar.gz
#cd apr-util-1.4.1
#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
#make
#make install
3安装pcre
#unzip -o pcre-8.30.zip
#cd pcre-8.30
#./configure --prefix=/usr/local/pcre
#make
#make install
4安装Apache
tar -xzvf httpd-2.4.2.tar.gz
cd httpd-2.4.2
./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
5启动Apache
cd /usr/local/apache/bin
./apachectl start
如果需要新版本:
http://httpd.apache.org/download.cgi
http://apr.apache.org/download.cgi
http://sourceforge.net/projects/pcre/
======结束========

 

 

 

下文仅仅是简单记录了apache2.4.4的安装过程,没有过多的讲解,详细了解请参考 http://www.linuxidc.com/Linux/2013-05/84940.htm

安装环境:CentOS6.3

一、下载安装包

wget http://mirror.bjtu.edu.cn/apache/httpd/httpd-2.4.4.tar.bz2  //apache2.4.4

wget http://mirror.bjtu.edu.cn/apache/apr/apr-1.4.6.tar.bz2  //apr

wget http://mirror.bjtu.edu.cn/apache/apr/apr-util-1.5.1.tar.bz2  //apr-util

wget http://sourceforge.net/projects/pcre/files/pcre/8.32/pcre-8.32.tar.bz2/download  //pcre

APR(Apache portable Run-time libraries,Apache可移植运行库)主要为上层的应用程序提供一个可以跨越多操作系统平台使用的底层支持接口库

PCRE用于提供编译环境的函数库

其实apache有APR绑定的安装包,我没用

 

二、准备安装环境

解包

tar -jxvf apr-util-1.5.1.tar.bz2 
tar -jxvf apr-1.4.6.tar.bz2 
tar -jxvf httpd-2.4.4.tar.bz2 
tar -zxvf pcre-8.32.tar.gz

1.安装C++

yum  install gcc-c++  //安装C++编译环境

2.安装 APR

cd apr-1.4.6/

./configure --prefix=/usr/local/apr-1.4.6  //配置

make    //编译

make test    //测试

make install    //安装

3.安装APR-UTIL

cd ../apr-util-1.5.1/

./configure --prefix=/usr/local/apr-util-1.5.1

./configure --prefix=/usr/local/apr-util-1.5.1 --with-apr=/usr/local/apr-1.4.6/

make

make test

make install

4.安装 PCRE

cd ../pcre-8.32/

./configure

make

make check

make install

5.安装apache

cd ../httpd-2.4.4/

./configure --prefix=/usr/local/apache --enable-mods-shared=all --with-apr=/usr/local/apr-1.4.6/ --with-apr-util=/usr/local/apr-util-1.5.1/    //--prefix指定安装路径,--enable-mods-shared启用所有支持的动态加载模块,--with-apr指定APR路径,--with-apr-util指定APR-util路径

make

make install

/usr/local/apache/bin/apachectl start    //启动apache

 

三、注册apache为系统服务

cp  /usr/local/apache/apachectl /etc/init.d/httpd    //把apache启动脚本复制到系统脚本目录下

vi  /etc/init.d/httpd在第一行下插入# chkconfig: 2345 85 35    //修改脚本用于在运行界别2345下自启动,并指定启动脚本序号为85,关闭脚本序号为35

chkconfig --add httpd    //注册为自启动服务

四、修改防火墙设置

vi /etc/sysconfig/iptables  //编辑iptables配置文件

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT    //在适当位置插入

service iptables restart    //重启防火墙服务

搭建Apache服务

标签:

原文地址:http://www.cnblogs.com/bruisebd/p/5386075.html

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