nginx配置apache

转自:http://www.linuxidc.com/Linux/2013-05/84945.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-included-apr=/usr/local/apr/ --with-included-apr-util=/usr/local/apr-util/

   //--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/bin/apachectl /etc/init.d/httpd    //把apache启动脚本复制到系统脚本目录下

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

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

服务不支持chkconfig解决过程介绍

用chkconfig将自编译设置为系统服务的时候,httpd 服务不支持chkconfig。解决过程如下:

1.编辑/etc/init.d/httpd

#!/bin/bash
#chkconfig:345 61 61
 

#description:Apache httpd

(哈哈,复制粘贴好像有问题,手动输入)

2.配置
 

[root@localhost ~]# chkconfig --add httpd
[root@localhost ~]# chkconfig --list|grep httpd
 

httpd           0:关闭 1:关闭  2:关闭 3:关闭  4:关闭  5:关闭  6:关闭

[root@localhost ~]# chkconfig --level 345 httpd on
[root@localhost ~]# chkconfig --list|grep httpd


四、修改防火墙设置

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

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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值