CentOS 6编译httpd-2.4.10
2016-01-14 18:40
375 查看
前提:安装环境:CentOS 6.7apr相关包:apr-1.5.0.tar 、apr-util-1.5.3.tarhttpd包:httpd-2.4.10.tar 一、CentOS 6编译httpd-2.4前期配置 1.apr: apache portableruntime,apache可移植环境 CentOS 6:上默认:apr-1.3.9,apr-util-1.3.9版本 但是httpd2.4依赖于较新版本的apr,apr-1.4+,apr-util-1.4+, [apr-iconv](可选),需编译安装 apr和apr-util版本无需一致 2.所需开发环境包组和开发程序包 # yum install -y "DevelopmentTools" "Server Platform Development" # yum install -y pcre-devel 二、编译安装1.4+版的apr和apr-util 1.编译安装apr-1.5.0.tar [root@localhosttmp]# tar xf apr-1.5.0.tar.bz2 [root@localhosttmp]# cd apr-1.5.0 [root@localhostapr-1.5.0]# ./configure --prefix=/usr/local/apr [root@localhostapr-1.5.0]# make -j 4 && make install 2.编译安装apr-util-1.5.3.tar [root@localhosttmp]# tar xf apr-util-1.5.3.tar.bz2 [root@localhosttmp]# cd apr-util-1.5.3 [root@localhostapr-util-1.5.3]# ./configure --prefix=/usr/local/apr-util --with=/usr/local/apr [root@localhostapr-1.5.0]# make -j 4 && make install 注意:编译安装时候要指明所编译需要的安装包,否则会找系统的开发包作为依赖安装包 三、编译启动httpd-2.4服务 1.编译httpd-2.4.10.tar [root@localhosttmp]# tar xf httpd-2.4.10.tar.bz2 [root@localhosttmp]# cd httpd-2.4.10 [root@localhosttmp]# ./configure --prefix=/usr/local/apache24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi--enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util --enable-modules=most--enable-mpms-shared=all --with-mpm=prefork [root@localhosttmp]# make -j 4 [root@localhosttmp]# make install安装选项说明: /usr/local/apache24/build/config.nice:记录了安装时候所执行的命令
2.自带启动脚本:apachectl (1)方法一:手动指明路径启动 因为编译安装,所以启动服务需指定具体路径:/usr/local/apache24/bin/apachectl start (2)方法二:更改环境变量直接手动绝对路径 1) # vim /etc/profile.d/httpd.sh exportPATH=/usr/local/apache24/bin:$PATH 2) # apachectl start (3)方法三:开机启动脚本 # cd /etc/rc.d/init.d/ # vim httpd24 # chkconfig --add httpd24 #service httpd24 start=================================CentOS 6 服务脚本============================================#!/bin/bash## httpd Startup script for the Apache HTTPServer## chkconfig: - 85 15# description: TheApache HTTP Server is an efficient and extensible \# server implementing the current HTTPstandards.# processname: httpd# config:/etc/httpd/conf/httpd.conf# config:/etc/sysconfig/httpd# pidfile:/var/run/httpd/httpd.pid#### BEGIN INIT INFO# Provides: httpd# Required-Start:$local_fs $remote_fs $network $named# Required-Stop:$local_fs $remote_fs $network# Should-Start:distcache# Short-Description:start and stop Apache HTTP Server# Description: TheApache HTTP Server is an extensible server# implementing the current HTTP standards.### END INIT INFO # Source functionlibrary../etc/rc.d/init.d/functions if [ -f/etc/sysconfig/httpd ]; then . /etc/sysconfig/httpdfi # Start httpd in theC locale by default.HTTPD_LANG=${HTTPD_LANG-"C"} # This will preventinitlog from swallowing up a pass-phrase prompt if# mod_ssl needs apass-phrase from the user.INITLOG_ARGS="" # SetHTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server# with thethread-based "worker" MPM; BE WARNED that some modules may not# work correctlywith a thread-based MPM; notably PHP will refuse to start. # Path to theapachectl script, server binary, and short-form for messages.apachectl=/usr/local/apache/bin/apachectlhttpd=/usr/local/apache/bin/httpdprog=httpdpidfile=${PIDFILE-/var/run/httpd/httpd24.pid}lockfile=${LOCKFILE-/var/lock/subsys/httpd24}RETVAL=0STOP_TIMEOUT=${STOP_TIMEOUT-10} # The semantics ofthese two functions differ from the way apachectl does# things --attempting to start while running is a failure, and shutdown# when not runningis also a failure. So we just do it theway init scripts# are expected tobehave here.start() { echo -n $"Starting $prog: " LANG=$HTTPD_LANG daemon--pidfile=${pidfile} $httpd $OPTIONS RETVAL=$? echo [ $RETVAL = 0 ] && touch${lockfile} return $RETVAL} # When stoppinghttpd, a delay (of default 10 second) is required# before SIGKILLingthe httpd parent; this gives enough time for the# httpd parent toSIGKILL any errant children.stop() {echo-n $"Stopping $prog: "killproc-p ${pidfile} -d ${STOP_TIMEOUT} $httpdRETVAL=$?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 $"not reloading due toconfiguration syntax error" failure $"not reloading $httpd dueto configuration syntax error" else # Force LSB behaviour from killproc LSB=1 killproc -p ${pidfile} $httpd-HUP RETVAL=$? if [ $RETVAL -eq 7 ]; then failure $"httpd shutdown" fi fi echo} # See how we werecalled.case "$1"in start)start;; stop)stop;; status) status -p ${pidfile} $httpdRETVAL=$?;; restart)stopstart;; condrestart|try-restart)ifstatus -p ${pidfile} $httpd >&/dev/null; thenstopstartfi;; 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=2esac exit $RETVAL=====================================================================================================
本文出自 “许鼎的博客” 博客,请务必保留此出处http://xuding.blog.51cto.com/4890434/1735113
--prefix=/usr/local/apache24 | 指定安装路径 |
--sysconfdir=/etc/httpd24 | 更改定义配置文件的安装路径,不指明就在安装路径下 |
--enable-so | 支持DSO机制 |
--enable-ssl | 支持ssl功能 |
--enable-cgi | 支持cgi机制 |
--enable-rewrite | 支持URL重写 |
--with-zlib | 依赖于Zlib提供压缩库实现页面压缩 |
--with-pcre | 支持pcre扩展的模式,更为强大的正则表达式功能 |
--with-apr=/usr/local/apr | 依赖于指定路径的apr |
--with-apr-util=/usr/local/apr-util | 依赖于指定路径的apr-util |
--enable-modules=most | 启用模块,可以给模块列表,可以most大多数常用模块,也可以All |
--enable-mpms-shared=all | 将所有的MPM模块编译出来 |
--with-mpm=prefork | 指定启动时默认的MPM模块 |
本文出自 “许鼎的博客” 博客,请务必保留此出处http://xuding.blog.51cto.com/4890434/1735113
相关文章推荐
- Oracle LOB类型 总结 --整理与网络收集资料
- 深度学习与自然语言处理之四:卷积神经网络模型(CNN)
- httpd2.4的新特性、以及基本应用
- Linux 系统应用编程——网络编程(I/O模型)
- Linux Netcat 命令——网络工具中的瑞士军刀
- Spring远程调用HTTP invoker
- tcpdump抓包命令详解
- httpclient4.5+disruptor3.3.2+mongodb3.2+jsoup写的一个抓取小程序
- 经常遇到的http状态码
- Http协议的理解
- win10 vm虚拟机 报错 设备vmnet0上的网络桥接当前未在运行
- C#WebService 客户端通过Http调用请求(转)
- 写给那些让我糊里糊涂的HTTP、TCP、UDP、Socket
- [网络基础]网络基础篇
- 【HttpClient4.5中文教程】其他章节及总结
- Android 2016最热网络请求开发框架之Okhttp ,facebook强烈推荐必备开发
- 看到 https://selfstore.io/ 这种在线出版网站想到的
- Android中使用Retrofit库进行Http通讯
- 手动搭建openstack的计算节点网络
- kindeditor 去掉网络图片上传功能