CentOS 6编译httpd-2.4.10

前提:

安装环境:CentOS 6.7

apr相关包:apr-1.5.0.tar  、apr-util-1.5.3.tar

httpd包: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

[[email protected]]# tar xf apr-1.5.0.tar.bz2

[[email protected]]# cd apr-1.5.0

[[email protected]]# ./configure --prefix=/usr/local/apr

[[email protected]]# make -j 4 && make install

2.编译安装apr-util-1.5.3.tar

[[email protected]]# tar xf apr-util-1.5.3.tar.bz2

[[email protected]]# cd apr-util-1.5.3

[[email protected]]# ./configure --prefix=/usr/local/apr-util --with=/usr/local/apr

[[email protected]]# make -j 4 && make install

注意:编译安装时候要指明所编译需要的安装包,否则会找系统的开发包作为依赖安装包

三、编译启动httpd-2.4服务

1.编译httpd-2.4.10.tar

[[email protected]]# tar xf httpd-2.4.10.tar.bz2

[[email protected]]# cd httpd-2.4.10

[[email protected]]# ./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

[[email protected]]# make -j  4

[[email protected]]# make install

安装选项说明:

/usr/local/apache24/build/config.nice:记录了安装时候所执行的命令


--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模块

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/httpd

fi

# 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/apachectl

httpd=/usr/local/apache/bin/httpd

prog=httpd

pidfile=${PIDFILE-/var/run/httpd/httpd24.pid}

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

RETVAL=0

STOP_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} $httpd

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 $"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} $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)

[email protected]

RETVAL=$?

;;

*)

echo$"Usage: $prog{start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"

RETVAL=2

esac

exit $RETVAL

=====================================================================================================

时间: 2024-12-17 15:22:20

CentOS 6编译httpd-2.4.10的相关文章

CentOS 6 编译安装subversion-1.8.10+Apache2.4

只是记录下安装过程,方便下次直接拷贝,省的在去查找一些选项. CentOS6安装完成后自带的有Apache2.2和subversion1.6,那我们就先来看系统自带的如何配置: 一.用系统自带的Apache和svn配置 1.添加svn用户 # useradd -r -s /sbin/nologin svn 2.配置Apache的配置文件 # mkdir -pv /www/svnroot/                          # 为svn建立库目录 # chown -R svn.sv

Centos 7 编译php 7.2.10

步骤一:安装依赖 yum install -y wget gcc gcc-c++ gd-devel zlib-devel libjpeg-devel libpng-devel libiconv-devel freetype-devel libxml2 libxml2-devel openssl openssl-devel curl-devel libxslt-devel libmcrypt-devel mhash mcrypt 步骤二:下载php安装包 wget http://101.247.1

CentOS 6.9编译安装Python-2.7.10

Python官网:https://www.python.org/ 一.查看CentOS版本和系统默认Python版本: # cat /etc/redhat-release # python -V 二.编译安装Python-2.7.10: 1.  安装依赖软件包及包组: # yum -y groupinstall "Development tools" # yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devels

CentOS 编译安装Apache2.4.10

1.准备编译环境 yum -y install gcc make cmake autoconf libtool libevent 安装apache必须的依赖包 yum -y install apr-util apr pcre pcre-devel 2.下载软件包 wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.10.tar.gz 解压软件包: tar -xzf httpd-2.4.10.tar.gz 3.编译安装(Apache 版本低于

CentOS 7.2 下编译安装PHP7.0.10+MySQL5.7.14+Nginx1.10.1的方法

这篇文章主要介绍了CentOS 7.2 mini版本下编译安装PHP7.0.10+MySQL5.7.14+Nginx1.10.1的方法,非常不错,具有参考借鉴价值,需要的朋友可以参考下一.安装前的准备工作 1.yum update #更新系统 2.yum install gcc gcc-c++ autoconf automake cmake bison m4 libxml2 libxml2-devel libcurl-devel libjpeg-devel libpng-devel libicu

Centos 7编译安装 LAMP 环境

前言 LAMP 是指一组通常一起使用来运行动态网站或者服务器的自由软件名称首字母缩写 L:Linux 操作系统 A:Apache(httpd) 网页服务 M:MySQL(mariadb) 数据库服务 P:php/perl/python/ruby 脚本编程语言 本文主要以centos 7的环境下进行安装,centos 6兼带部分说明 一.http2.4的安装 Centos 7默认安装httpd 2.4,Centos 6默认安装httpd2.2 Centos 7:如果未安装http2.4,则通过yu

【apache http server安装】CentOS上编译安装Aapche Http Server详细过程

下载apache httpd # wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.10.tar.gz 2. 解压 apache httpd # tar xzvf httpd-2.4.10.tar.gz 编译apache httpd [[email protected]]# ./configure checkingfor chosen layout... Apache checkingfor working mkdir -p... yes

CentOS6.5 LAMP之一编译httpd

apache服务器程序 命令httpd: -t 测试配置文件 -l 静态模块 -D DUMP_MODULES 动态模块 -h获得帮助 -M:相当于-D DUMP_MODULES -D DUMP_VHOSTS:列出虚拟主机 htpasswd: 为基于文件basic认证创建和更新用户认证文件 apachectl 自带脚本 apachectl start 开启httpd服务 httpd服务控制工具: ab:apache benchmark Apache性能基准测试工具 apxs:httpd得以扩展使用

CentOS 6 编译LAMP 实现双机FastCGI

需求: CenOS 6平台搭建LAMP,其中php作为独立的服务工作 (1)三者分离于两台主机 (2)一个虚拟主机用于提供phpMyAdmin:另一个虚拟主机提供wordpress (3)安装下cache,为php提供加速 (4)mpm为prefork模型 注意: (1)由于httpd是cpu密集型,php是io密集型,而mariadb即是cpu密集型又是io密集型.所以我们将httpd和php放在一台主机上,mariadb单独放在一台主机上 (2)由于CentOS 6平台仅提供了mysql的r