apache编译安装 httpd 2.2 httpd 2.4
#apache编译安装
#httpd 2.2 , httpd 2.4
#!/bin/sh
#apache编译安装
#httpd 2.2 , httpd 2.4
#centos #rpm -e httpd*
Ve=2.2
[ $ = 2.4 ] && Ve=2.4 || Ve=2.2 #设置安装版本2.2或2. #目录
Ddir=/it/tools #定义下载目录
Sdir=/www/server #定义安装目录
Adir=$Sdir/apache$Ve
[ ! -d $Ddir ] && mkdir -p $Ddir
mkdir -p $Adir echo '#安装需要的库'
yum install make gcc gcc-c++ pcre pcre-devel zlib* -y
yum install expat-devel -y #安装apr-util需要
#yum install apr apr-util -y
yum install wget lrzsz -y
yum install openssl openssl-devel -y # echo '#添加用户'
# useradd apache -s /sbin/nologin -M
# id apache echo "#下载"
cd $Ddir
wget http://mirrors.aliyun.com/apache/apr/apr-1.6.2.tar.gz
wget http://mirrors.aliyun.com/apache/apr/apr-util-1.6.0.tar.gz
wget https://ftp.pcre.org/pub/pcre/pcre-8.41.tar.gz
[ $Ve = 2.4 ] && {
wget http://mirrors.aliyun.com/apache/httpd/httpd-2.4.27.tar.gz ;
}|| {
wget http://mirrors.aliyun.com/apache/httpd/httpd-2.2.34.tar.gz ;
} echo "解压"
tar -xf apr-.*.tar.gz
tar -xf apr-util-.*.tar.gz
tar -xf pcre-.*.tar.gz
tar -xf httpd-$Ve.*.tar.gz
[ $? = ] || { echo "解压出现问题 !";exit; } echo "#安装"
mkdir -p $Sdir/http/{apr,apr-util,pcre}
cd $Ddir
#apr
cd apr-.*
./configure --prefix=$Sdir/http/apr/
[ $? = ] || { echo "编译出现问题 !";exit; }
make && make install
cd ..
#apr-util
cd apr-util-.*
./configure --prefix=$Sdir/http/apr-util/ --with-apr=$Sdir/http/apr/
[ $? = ] || { echo "编译出现问题 !";exit; }
make && make install
cd ..
#pcre
cd pcre-.*
./configure --prefix=$Sdir/http/pcre/
[ $? = ] || { echo "编译出现问题 !";exit; }
make && make install
cd .. #httpd
cd $Ddir/httpd-$Ve.*
#./configure --help
./configure \
--prefix=$Adir \
--enable-deflate \
--enable-expires \
--enable-headers \
--enable-modules=most \
--enable-so \
--with-mpm=worker \
--enable-rewrite \
--with-apr=$Sdir/http/apr/ \
--with-apr-util=$Sdir/http/apr-util/ \
--with-pcre=$Sdir/http/pcre/ \
ap_cv_void_ptr_lt_long=no
#
[ $? = ] || { echo "编译出现问题 !";exit; }
echo 编译安装
make -j4 && make install
echo '#编译模块查看'
$Adir/bin/apachectl -l pkill `netstat -antp|grep |awk -F '/' '{ print $2}'` &>/dev/null #关闭80端口进程
echo "ServerName localhost:80">>$Adir/conf/httpd.conf
echo '#启动apache'
$Adir/bin/apachectl start
echo '#查看'
netstat -antp|grep httpd
ps -ef|grep http|grep -v "grep"
echo "$Adir/bin/apachectl { start|restart|stop }" # 加入系统服务,开机启动
sed -i -e '2 i #chkconfig: 2345 70 60 \n#description: apache' $Adir/bin/apachectl
# ln -s $Adir/bin/apachectl /etc/init.d/httpd
# echo "$Adir/bin/apachectl start">>/etc/rc.local
# chkconfig --add httpd
# chkconfig httpd on
# chkconfig --list httpd # # #添加环境变量
# echo "export PATH=$Adir/bin:$PATH">>/etc/profile.d/httpd.sh
# . /etc/profile.d/httpd.sh # #添加库文件至系统
# echo "$Adir/include/">>/etc/ld.so.conf.d/httpd.conf
# ldconfig # #man文档添加至系统
# man -M $Adir/man httpd
# echo "MANPATH $Adir/man">>/etc/man.config # #隐藏头文件版本
# echo "#隐藏头文件版本
# ServerTokens ProductOnly
# ServerSignature Off
# ">>$Adir/conf/httpd.conf #php 测试
echo '<?php phpinfo(); ?>'>$Adir/htdocs/test.php
# other
#--sysconfdir=/etc/httpd \ #Apache配置php
#php编译时,需要有参数--with-apxs2=/apache安装目录/bin/apxs \
#php编译完成后,apache配置文件里会自动添加php模块LoadModule php5_module module/libphp5.so
#echo "Addtype application/x-httpd-php .php .phtml">>$Adir/conf/httpd.conf #开启php支持 #另一种方式,使用fcgi接口方式,传递php给独立php进程解析,配置略
apache编译安装 httpd 2.2 httpd 2.4的更多相关文章
- LANMP系列教程之Apache编译安装CentOS7环境
1.准备好源码包并配置好yum源,需要的源码包包括:httpd-2.4.18.apr-1.5.2.tar.gz.apr-util-1.5.4.tar.gz 2.准备用户 groupadd -r a ...
- Apache编译安装
1.准备好源码包并配置好yum源,需要的源码包包括:httpd-2.4.18.apr-1.5.2.tar.gz.apr-util-1.5.4.tar.gz 2.准备用户 groupadd -r apa ...
- apache编译安装参数说明
apache编译安装参数说明 ./configure //配置源代码树--prefix=/usr/local/apache2 //体系无关文件的顶级安装目录prefix ,也就apache的安装目录. ...
- 末学者笔记--apache编译安装及LAMP架构上线
apache介绍 一.Apache的三种工作模式 Apache一共有3种稳定的MPM模式(多进程处理模块),它们分别是prefork.worker.event.http-2.2版本的httpd默认的m ...
- Centos 7 Apache编译安装
1.安装apache ./configure --prefix=/usr/local/apache2 --enable-rewrite --enable-so --enable-headers --e ...
- Apache编译安装及LAMP架构
1.apache三种工作模式 1)prefork工作模式 一个进程处理一个用户请求 稳定但是不适合高并发的生产环境 2)worker工作模式 一个进程生成多个线程 合适高并发环境但是需要考虑到线程的安 ...
- Apache 编译安装
# wget http://www.apache.org/dist/httpd/httpd-2.2.9.tar.gz (此处我是直接用的下载好的包) # tar -zxvf httpd-2.2.9. ...
- apache编译安装php后需要注意以下配置
安装后, 编辑apache配置文件 vi /usr/local/apache2/conf/httpd.conf 可以看到 LoadModule php7_module modules/libphp7. ...
- LAMP 1.2 Apache编译安装
1.下载 ...
随机推荐
- C++const使用(06)
可以在类中使用const关键字定义数据成员和成员函数或修饰一个对象.一个const对象只能访问const成员函数,否则将产生编译错误. 常量成员 常量成员包括常量数据成员.静态常数据成员和常引用.静态 ...
- CentOs 系统启动流程相关
CentOS的启动流程 1)加载BIOS 的硬件信息,获取第一个启动设备 2)读取第一个启动设备MBR 的引导加载程序(grub) 的启动信息 3)加载核心操作系统的核心信息,核心开始解压缩,并尝试驱 ...
- 实验排队功能实现(JAVA)
1.功能要求 实验室有固定台数的设备供学生通过网络连接进行实验,一台设备只能同时被一个用户使用,一个用户只能占用一台设备. 下面是一个功能的简图: 2.实现方案 2.1 初始化 在项目启动之后,开始进 ...
- [PGM] Bayes Network and Conditional Independence
2 - 1 - Semantics & Factorization 2 - 2 - Reasoning Patterns 2 - 3 - Flow of Probabilistic Influ ...
- java中matches的用法
在java中,时常会用到查看一个字符串是否是数字,这时就可以用到matches()函数. 具体实例如下: public boolean string_matches(String amatch) { ...
- 安装jdk时出现java -version权限不够问题
今天在ubuntu上安装jdk的时候,最后测试java -version总是不行,出现了 bash: /home/jdk1.7.0_25/bin/java: 权限不够的问题 百度之后,在http:// ...
- 针对数据量较大的表,需要进行跨库复制,采用navcat 实现sqlite数据库跨数据库的数据表迁移 [转载]
2014年12月13日 14:36 新浪博客 (转自http://www.cnblogs.com/nmj1986/archive/2012/09/17/2688827.html) 需求: 有两个不同的 ...
- javascript中的变量、作用域和内存问题
1.变量 变量的值的类型:基本类型值和引用类型值两种. 基本类型:Undefined.Null.Boolean.String.Number,这五类基本数据类型的值在内存中占有固定大小的空间,因此保存在 ...
- CentOS7修改网卡名称,禁用ipv6
有时候新装的CentOS7系统网卡默认名称是eno16777736,为方便改成传统eth0 修改网络配置文件 # cd /etc/sysconfig/network-script/ # vim ifc ...
- SQL Server 审计
审计(Audit)用于追踪和记录SQL Server实例或数据库中发生的事件,审计主要包括审计对象(Audit)和审计规范(Audit Specification),创建审计首先需要创建一个SQL S ...