分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 软件开发

apache编译安装 httpd 2.2 ?httpd 2.4

发布时间:2023-09-06 01:22责任编辑:熊小新关键词:apachehttp编译

#apache编译安装
#httpd 2.2 , httpd 2.4

#!/bin/sh#apache编译安装#httpd 2.2 , httpd 2.4#centos #rpm -e httpd*Ve=2.2[ $1 = 2.4 ] && Ve=2.4 || Ve=2.2 #设置安装版本2.2或2.4#目录Ddir=/it/tools ?#定义下载目录Sdir=/www/server #定义安装目录Adir=$Sdir/apache$Ve[ ! -d $Ddir ] ?&& mkdir -p $Ddirmkdir -p $Adirecho ‘#安装需要的库‘yum install make gcc gcc-c++ pcre pcre-devel zlib* -yyum install expat-devel -y #安装apr-util需要#yum install apr apr-util -yyum install wget lrzsz -yyum install openssl openssl-devel -y # echo ‘#添加用户‘# useradd apache -s /sbin/nologin -M # id apacheecho "#下载"cd $Ddirwget http://mirrors.aliyun.com/apache/apr/apr-1.6.2.tar.gzwget http://mirrors.aliyun.com/apache/apr/apr-util-1.6.0.tar.gzwget 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-1.*.tar.gztar -xf apr-util-1.*.tar.gztar -xf pcre-8.*.tar.gztar -xf httpd-$Ve.*.tar.gz[ $? = 0 ] || { echo "解压出现问题 !";exit; }echo "#安装"mkdir -p $Sdir/http/{apr,apr-util,pcre}cd $Ddir#aprcd apr-1.*./configure --prefix=$Sdir/http/apr/[ $? = 0 ] || { echo "编译出现问题 !";exit; }make && make installcd ..#apr-utilcd apr-util-1.*./configure --prefix=$Sdir/http/apr-util/ --with-apr=$Sdir/http/apr/[ $? = 0 ] || { echo "编译出现问题 !";exit; }make && make installcd ..#pcrecd pcre-8.*./configure ?--prefix=$Sdir/http/pcre/[ $? = 0 ] || { echo "编译出现问题 !";exit; }make && make installcd ..#httpdcd $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 #[ $? = 0 ] || { echo "编译出现问题 !";exit; }echo 编译安装make -j4 && make installecho ‘#编译模块查看‘$Adir/bin/apachectl -l pkill `netstat -antp|grep 80|awk -F ‘/‘ ‘{ print $2}‘` &>/dev/null #关闭80端口进程echo "ServerName localhost:80">>$Adir/conf/httpd.confecho ‘#启动apache‘$Adir/bin/apachectl startecho ‘#查看‘netstat -antp|grep httpdps -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

原文地址:http://www.cnblogs.com/elvi/p/7717896.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved