1.

tar xvf apr-1.6.2.tar.gz

tar xvf apr-util-1.6.0.tar.gz

tar xvf httpd-2.4.28.tar.bz2

2.

cp -a apr-1.6.2 httpd-2.4.28/srclib/apr

cp -a apr-util-1.6.0 httpd-2.4.28/srclib/apr-util

3.

getent passwd apache查看apache帐户

须保证apache用户为系统用户

则需要userdel -r apache删除用户重新创建

创建apache用户需指定家目录及登录shell

groupadd -g 48 -r apache;useradd -r -u 48 -g apache -s /sbin/nologin -d /usr/share/httpd -c "Apache" apache 规范点的写法如此,也可以简单的写

useradd -r -d /app/httpd24 -m -s /sbin/nologin apache

4.

缺包装包

yum groupnstall 'development-tools'

yum install openssl-devel pcre-devel expat-devel

5.

cd httpd-2.4.28/

./configure --prefix=/app/httpd24 \

--enable-so \

--enable-ssl \

--enable-cgi \

--enable-rewrite \

--with-zlib \

--with-pcre \

--with-included-apr \

--enable-modules=most \

--enable-mpms-shared=all \

--with-mpm=prefork

6.make -j 4 && make install

7.

path变量

vim /etc/profile.d/httpd.sh

PATH=/app/httpd24/bin:$PATH


. /etc/profile.d/httpd.sh

8.

修改运行服务的用户

vim /app/http24/conf/httpd.conf

User apache

Group apache

9.准备服务脚本

cd /etc/init.d

cp httpd httpd24


服务脚本httpd,这里改为httpd24以便区分。httpd为原httpd包自带的,rpm -q --scripts httpd查看之前的服务脚本。或者从别的地方拷一个。这里阿拉拷贝好了一个。

#!/bin/bash
#
#httpdStartupscriptfortheApacheHTTPServer
#
#chkconfig:-8515
#description:TheApacheHTTPServerisanefficientandextensible\
#serverimplementingthecurrentHTTPstandards.
#processname:httpd
#config:/etc/httpd/conf/httpd.conf
#config:/etc/sysconfig/httpd
#pidfile:/var/run/httpd/httpd.pid
#
###BEGININITINFO
#Provides:httpd
#required-Start:$local_fs$remote_fs$network$named
#required-Stop:$local_fs$remote_fs$network
#Should-Start:distcache
#Short-Description:startandstopApacheHTTPServer
#Description:TheApacheHTTPServerisanextensibleserver
#implementingthecurrentHTTPstandards.
###ENDINITINFO

#Sourcefunctionlibrary.
./etc/rc.d/init.d/functions

if[-f/etc/sysconfig/httpd];then
./etc/sysconfig/httpd
fi

#StarthttpdintheClocalebydefault.
HTTPD_LANG=${HTTPD_LANG-"C"}

#Thiswillpreventinitlogfromswallowingupapass-phrasepromptif
#mod_sslneedsapass-phrasefromtheuser.
INITLOG_ARGS=""
#SetHTTPD=/usr/sbin/httpd.workerin/etc/sysconfig/httpdtouseaserver
#withthethread-based"worker"MPM;BEWARNEDthatsomemodulesmaynot
#workcorrectlywithathread-basedMPM;notablyPHPwillrefusetostart.

#Pathtotheapachectlscript,serverbinary,andshort-formformessages.
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
STOP_TIMEOUT=${STOP_TIMEOUT-10}

#Thesemanticsofthesetwofunctionsdifferfromthewayapachectldoes
#things--attemptingtostartwhilerunningisafailure,andshutdown
#whennotrunningisalsoafailure.sowejustdoitthewayinitscripts
#areexpectedtobehavehere.
start(){
echo-n$"Starting$prog:"
LANG=$HTTPD_LANGdaemon--pidfile=${pidfile}$httpd$OPTIONS
RETVAL=$?
echo
[$RETVAL=0]&&touch${lockfile}
return$RETVAL
}

#Whenstoppinghttpd,adelay(ofdefault10second)isrequired
#beforeSIGKILLingthehttpdparent;thisgivesenoughtimeforthe
#httpdparenttoSIGKILLanyerrantchildren.
stop(){
status-p${pidfile}$httpd>/dev/null
if[[$?=0]];then
echo-n$"Stopping$prog:"
killproc-p${pidfile}-d${STOP_TIMEOUT}$httpd
else
echo-n$"Stopping$prog:"
success
fi
RETVAL=$?
echo
[$RETVAL=0]&&rm-f${lockfile}${pidfile}
}
reload(){
echo-n$"Reloading$prog:"
if!LANG=$HTTPD_LANG$httpd$OPTIONS-t>&/dev/null;then
RETVAL=6
echo$"notreloadingduetoconfigurationSyntaxerror"
failure$"notreloading$httpdduetoconfigurationSyntaxerror"
else
#ForceLSBbehavIoUrfromkillproc
LSB=1killproc-p${pidfile}$httpd-HUP
RETVAL=$?
if[$RETVAL-eq7];then
failure$"httpdshutdown"
fi
fi
echo
}
#Seehowwewerecalled.
case"$1"in
start)
start
;;
stop)
stop
;;
status)
status-p${pidfile}$httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart|try-restart)
ifstatus-p${pidfile}$httpd>&/dev/null;then
stop
start
fi
;;
force-reload|reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl$@
RETVAL=$?
;;
*)
echo$"Usage:$prog{start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"
RETVAL=2
esac

exit$RETVAL


更改相关路径

vim httpd24

apachectl=/app/httpd24/bin/apachectl

httpd={HTTPD-/app/httpd24/bin/httpd}

pidfile={PIDFILE-/app/httpd24/logs/http.pid}

lockfile={LOCKFILE-/var/lock/subsys/httpd24}

启动服务

chkconfig --add httpd24

chkconfig httpd24 on

service httpd24 start

10.测试

centos6编译httpd2.4的更多相关文章

  1. IOs Cordova长按显示文本选择放大镜即使禁用文本选择,如何删除?

    是否有任何可能导致此问题的插件?任何帮助深表感谢.Cordova插件:>com.mbppower.camerapreview>cordova-plugin-statusbar>cordova-plugin-whitelist>离子插件键盘>org.apache.cordova.camera>org.apache.cordova.console>org.apache.cordova.device>org.apache.cordova.dialogs>org.apache.cordova.file>org.a

  2. android – org.apache.cordova.api不存在. PhoneGap 3.0

    我正在尝试将VideoPlayer插件(https://github.com/macdonst/VideoPlayer)添加到我的phonegapAndroid应用程序中.在编译时遇到问题:第25行:解决方法将您的导入更改为:

  3. 如何将android客户端连接到我的笔记本电脑内的Apache服务器(php)的localhost?

    我的笔记本电脑中的localhost-127.0.0.1或android10.0.0.1中的localhost?>那么,如果我想从android访问localhost来调用PHP来运行?哪个ip地址/url我需要放在Android应用程序?我需要在httpconfig中为XAMPP修改任何内容吗?解决方法使用ipconfig在笔记本电脑中找到您的IP地址.在手机中使用该地址而不是127.0.0.1.

  4. android – 在android工作室中的proguard错误

    我想在我的应用程序中使用proguard,我启用它但是当我想生成apk文件时,它给了我这个错误:我正在使用最新版本的sdk23,这是我的gradle文件:怎么了?我在这段代码中做错了什么?谢谢解决方法只需在proguard上添加:

  5. 无法修复Android Proguard返回错误代码1错误

    当我尝试在我的Android应用程序中使用proguard时只需添加到我的project.properties文件,APK导出失败并显示消息Proguard返回错误代码1这是我的project.properties文件这是错误堆栈:解决方法将这些行添加到proguard配置文件(proguard-android.txt)见ProguardTroubleshooting请注意,如果您使用您的配置文件

  6. Phonegap 2.4 Android Proguard配置

    有人有主意吗???

  7. android – 如何在sharedPreferences中分析ANR

    在sharedPreferences中遇到ANR,不知道如何定位问题.以下是trace的三个部分,其他大多数线程都是“WAIT”或“TIMED_WAIT”.由于countdownlatch.await(),“主”线程被阻止.第二个线程“pool-1-thread-1”等待fsync.最后一个是试图读一些东西.我认为第二个线程已经阻塞了主线程,因为如果这个无法完成,它将不会调用countdownla

  8. Android无法访问org.apache.http.client.HttpClient

    我正在使用androidstudio创建一个向服务器发出GET请求的应用程序.我的代码是这样的:问题是AndroidStudio标记了这一行有错误:说“无法访问org.apache.http.client.HttpClient”这是我的gradle文件:解决方法在AndroidSDK23中不推荐使用HttpClient,因为它推断,您可以在HttpURLConnection中迁移代码https:/

  9. Android L – 没有对等证书

    我开发了一个小应用程序,使用带有自签名证书的SSL连接到我的服务器.为了使它工作,我使用BouncyCastleProvider将我的证书加载到自定义密钥库中,并在我的自定义SSLSocketFactory中导入证书.Everythink在android2.3(最小sdk)到4.4.4之间运行良好.但在androidL(预览版)中,我的应用失败了:TueAug1214:34:40BRT2014:j

  10. Android Http服务器和破碎的管道

    标题可能有问题吗?

随机推荐

  1. 在airgapped(离线)CentOS 6系统上安装yum软件包

    我有一个CentOS6系统,出于安全考虑,它已经被空气泄漏.它可能从未连接到互联网,如果有,它很长时间没有更新.我想将所有.rpm软件包放在一个驱动器上,这样它们就可以脱机安装而无需查询互联网.但是,我在测试VM上遇到的问题是,即使指定了本地路径,yum仍然会挂起并尝试从在线存储库进行更新.另外,有没有办法使用yum-utils/yumdownloader轻松获取该包的所有依赖项和所有依赖项?目前

  2. centos – 命名在日志旋转后停止记录到rsyslog

    CentOS6.2,绑定9.7.3,rsyslog4.6.2我最近设置了一个服务器,我注意到在日志轮换后,named已停止记录到/var/log/messages.我认为这很奇怪,因为所有日志记录都是通过rsyslog进行的,并且named不会直接写入日志文件.这更奇怪,因为我在更新区域文件后命名了HUPed,但它仍然没有记录.在我停止并重新启动命名后,记录恢复.这里发生了什么?

  3. centos – 显示错误的磁盘大小

    对于其中一个磁盘,Df-h在我的服务器上显示错误的空白区域:Cpanel表明它只有34GB免费,但还有更多.几分钟前,我删除了超过80GB的日志文件.所以,我确信它完全错了.fdisk-l/dev/sda2也显示错误:如果没有格式化,我该怎么做才能解决这个问题?并且打开文件描述符就是它需要使用才能做到这一点.所以…使用“lsof”并查找已删除的文件.重新启动写入日志文件的服务,你很可能会看到空间可用.

  4. 如何在centos 6.9上安装docker-ce 17?

    我目前正在尝试在centOS6.9服务器上安装docker-ce17,但是,当运行yuminstalldocker-ce时,我收到以下错误:如果我用跳过的标志运行它我仍然得到相同的消息,有没有人知道这方面的方法?

  5. centos – 闲置工作站的异常负载平均值

    我有一个新的工作站,具有不寻常的高负载平均值.机器规格是:>至强cpu>256GB的RAM>4x512GBSSD连接到LSI2108RAID控制器我从livecd安装了CentOS6.564位,配置了分区,网络,用户/组,并安装了一些软件,如开发工具和MATLAB.在启动几分钟后,工作站负载平均值的值介于0.5到0.9之间.但它没有做任何事情.因此我无法理解为什么负载平均值如此之高.你能帮我诊断一下这个问题吗?

  6. centos – Cryptsetup luks – 检查内核是否支持aes-xts-plain64密码

    我在CentOS5上使用cryptsetupluks加密加密了一堆硬盘.一切都很好,直到我将系统升级到CentOS6.现在我再也无法安装磁盘了.使用我的关键短语装载:我收到此错误:在/var/log/messages中:有关如何装载的任何想法?找到解决方案问题是驱动器使用大约512个字符长的交互式关键短语加密.出于某种原因,CentOS6中的新内核模块在由旧版本创建时无法正确读取512个字符的加密密钥.似乎只会影响内核或cryptsetup的不同版本,因为在同一系统上创建和打开时,512字符的密钥将起作用

  7. centos – 大量ssh登录尝试

    22个我今天登录CentOS盒找到以下内容这是过去3天内的11次登录尝试.WTF?请注意,这是我从我的提供商处获得的全新IP,该盒子是全新的.我还没有发布任何关于此框的内容.为什么我会进行如此大量的登录尝试?是某种IP/端口扫描?基本上有4名匪徒,其中2名来自中国,1名来自香港,1名来自Verizon.这只发生在SSH上.HTTP上没有问题.我应该将罪魁祸首子网路由吗?你们有什么建议?

  8. centos – kswap使用100%的CPU,即使有100GB的RAM也可用

    >Linux内核是否应该足够智能,只需从内存中清除旧缓存页而不是启动kswap?

  9. centos – Azure将VM从A2 / 3调整为DS2 v2

    我正在尝试调整前一段时间创建的几个AzureVM,从基本的A3和标准A3到标准的DS2v2.我似乎没有能力调整到这个大小的VM.必须从头开始重建服务器会有点痛苦.如果它有所不同我在VM中运行CentOS,每个都有一个带有应用程序和操作系统的磁盘.任何人都可以告诉我是否可以在不删除磁盘的情况下删除VM,创建新VM然后将磁盘附加到新VM?

  10. centos – 广泛使用RAM时服务器计算速度减慢

    我在非常具体的情况下遇到服务器速度下降的问题.事实是:>1)我使用计算应用WRF>2)我使用双XeonE5-2620v3和128GBRAM(NUMA架构–可能与问题有关!

返回
顶部