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.下载 ...
随机推荐
- Nginx监控-Nginx+Telegraf+Influxb+Grafana
搭建了Nginx集群后,需要继续深入研究的就是日常Nginx监控. Nginx如何监控?相信百度就可以找到:nginx-status 通过Nginx-status,实时获取到Nginx监控数据后,如何 ...
- Dagger2 入门解析
前言 在为dropwizard选择DI框架的时候考虑了很久.Guice比较成熟,Dagger2主要用于Android.虽然都是google维护的,但Dagger2远比guice更新的频率高.再一个是, ...
- .5-Vue源码之AST(1)
讲完了数据劫持原理和一堆初始化 现在是DOM相关的代码了 上一节是从这个函数开始的: // Line-3924 Vue.prototype._init = function(options) { // ...
- Lua中metatable和__index的联系
Lua中metatable和__index的联系 可以参考 http://blog.csdn.net/xenyinzen/article/details/3536708 来源 http://blog. ...
- js input输入事件兼容性问题
if(navigator.userAgent.indexOf('Android') > -1){ $("#sign").on("input", funct ...
- EasyWcf------无需配置,无需引用,动态绑定,轻松使用
设计原则:万物皆对象 前言:在上一篇的0配置使用Wcf中,虽然使用已经很方便了,但是对于最求极致简洁得人来说(比如我),客户端需要通过手动引用服务才能够调用服务接口,那么有没有办法能够绕过手动引用这一 ...
- 淘宝轮播JS
taobao首页轮播原生js面对对象封装版 Author:wyf 2012/2/25
- 关于隐藏元素高度的问题 css visibility:hidden 与 display:none的区别
其实这是一个老问题了,s visibility:hidden 与 display:none 共同点就是都会似的元素不可见.但是 visibility:hidden 的DOM元素是占用空间的,会挤占其他 ...
- Photoshop颜色出现比较大的偏差,偏色严重,显示器配置文件2351似乎有问题
其实出现这个问题是因为 显示器的配置问题.并不是PS版本或者电脑系统问题. 一般在你首次启动PS的时候会出现提示:显示器配置文件2351似乎有问题. 如果你点击了继续运行那以后你使用PS打开任何文件都 ...
- TextView SpannableString 使用之实现可点击超链接效果
TextView SpannableString 使用之实现可点击超链接效果 如果看到这里说明你对 TextView 已经有了一定的了解,至少已经使用过该控件显示文字过.现在来实现一些复杂一点的效果. ...