编译安装LAMP之httpd

编译安装httpd(httpd 2.4.4,相关软件包可到apache官网上下载)

# hwclock -s 将软件时间同步为硬件时间,防止安装软件时出错

1、解决依赖关系

httpd-2.4.4需要较新版本的apr和apr-util,因此需要事先对其进行升级。这里使用源码包进行升级(apr-1.5.2,apr-util-1.5.4 )

(1) 编译安装apr

# tar xf apr-1.5.2.tar.bz2

# cd apr-1.5.2

# ./configure --prefix=/usr/local/apr

# make && make install

(2) 编译安装apr-util

# tar xf apr-util-1.5.4.tar.bz2

# cd apr-util-1.5.4

# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

# make && make install

(3) httpd-2.4.4编译过程也要依赖于pcre-devel软件包,需要事先安装。

#yum -y install pcre-devel

(4) 可在编译安装httpd时会报错:checking for OpenSSL version >=0.9.7 ... FAILED

#yum -y install openssl-devel

#yum update openssl

2、编译安装httpd-2.4.4

# tar xf httpd-2.4.4.tar.bz2

# cd httpd-2.4.4

# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --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=most --with-mpm=event

(含义:--perfix=/usr/local/apache 指定安装路径;--sysconfdir=/etc/httpd 指定配置文件路径;--enable-so  apache核心装载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 支持模块:支持共享模块;--with-mpm=event加载模块event)

# make && make install

3、修改httpd的主配置文件,设置其Pid文件的路径

#vim /etc/httpd/httpd.conf,添加如下行即可:

PidFile  "/var/run/httpd.pid"

4、提供SysV服务脚本/etc/rc.d/init.d/httpd,内容如下:

#!/bin/bash

#

# httpd        Startup script for the Apache HTTP Server

#

# chkconfig: - 85 15

# description: Apache is a World Wide Web server.  It is used to serve \

#       HTML files and CGI.

# processname: httpd

# config: /etc/httpd/conf/httpd.conf

# config: /etc/sysconfig/httpd

# pidfile: /var/run/httpd.pid

# Source function library.

. /etc/rc.d/init.d/functions

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

. /etc/sysconfig/httpd

fi

# Start httpd in the C locale by default.

HTTPD_LANG=${HTTPD_LANG-"C"}

# This will prevent initlog from swallowing up a pass-phrase prompt if

# mod_ssl needs a pass-phrase from the user.

INITLOG_ARGS=""

# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server

# with the thread-based "worker" MPM; BE WARNED that some modules may not

# work correctly with a thread-based MPM; notably PHP will refuse to start.

# Path to the apachectl script, server binary, and short-form for messages.

apachectl=/usr/local/apache/bin/apachectl

httpd=${HTTPD-/usr/local/apache/bin/httpd}

prog=httpd

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

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

RETVAL=0

start() {

echo -n $"Starting $prog: "

LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS

RETVAL=$?

echo

[ $RETVAL = 0 ] && touch ${lockfile}

return $RETVAL

}

stop() {

echo -n $"Stopping $prog: "

killproc -p ${pidfile} -d 10 $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=$?

echo $"not reloading due to configuration syntax error"

failure $"not reloading $httpd due to configuration syntax error"

else

killproc -p ${pidfile} $httpd -HUP

RETVAL=$?

fi

echo

}

# See how we were called.

case "$1" in

start)

start

;;

stop)

stop

;;

status)

status -p ${pidfile} $httpd

RETVAL=$?

;;

restart)

stop

start

;;

condrestart)

if [ -f ${pidfile} ] ; then

stop

start

fi

;;

reload)

reload

;;

graceful|help|configtest|fullstatus)

$apachectl [email protected]

RETVAL=$?

;;

*)

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

exit 1

esac

exit $RETVAL

而后为此脚本赋予执行权限并加入服务列表:

# chmod +x /etc/rc.d/init.d/httpd

# chkconfig --add httpd

5.提供执行相关命令所需的环境变量

#vim /etc/profile.d/httpd.sh,添加以下内容:

export PATH=$PATH:/usr/local/apache/bin

6.至此,http服务配置结束,可以启动测试了

#service httpd restart

时间: 2024-08-07 08:38:46

编译安装LAMP之httpd的相关文章

马哥学习笔记六——编译安装LAMP只httpd

1.解决依赖关系 httpd-2.4.4需要较新版本的apr和apr-util,因此需要事先对其进行升级.升级方式有两种,一种是通过源代码编译安装,一种是直接升级rpm包.这里选择使用编译源代码的方式进行. (1) 编译安装apr # tar xf apr-1.4.6.tar.bz2 # cd apr-1.4.6 # ./configure --prefix=/usr/local/apr # make && make install (2) 编译安装apr-util # tar xf ap

编译安装LAMP[两种结合方式]

本文旨在实践编译安装LAMP环境,搭建Zblog系统,使用Xcache为PHP加速,分离PHP与Apache Server LAMP基础知识 Linux + Apache + MySQL[MariaDB] + PHP[Perl|Pyton] 是一套基础的web环境: Apache有2.2版本,和最新的2.4版本,2.4版本支持Event MPM可用作生产环境,在http2.2中有3种MPM,为不同的进程文件,切换需要重启Apache服务:而2.4中MPM做成了DSO,可动态加载切换: Apach

编译安装LAMP及分离式LAMP平台构建

前言 LAMP网站架构是目前国际流行的Web框架,该框架包括:Linux操作系统,Apache网站服务器,MySQL数据库,Perl.PHP或者Python编程语言,所有组成产品均是开源软件,是国际上成熟的架构框架,很多流行的商业应用都是采取这个架构,和Java/J2EE架构相比,LAMP具有Web资源丰富.轻量.快速开发等特点,与微软的.NET架构相比,LAMP具有通用.跨平台.高性能.低价格的优势,因此LAMP无论是性能.质量还是价格都是企业搭建网站的首选平台.但由于MySQL作为SUN公司

编译安装LAMP之一

环境:CentOS-6.5-i386-minimal httpd-2.2.27.tar.gz mysql-5.5.38-linux2.6-i686.tar.gz php-5.5.14.tar.gz 编译安装的原则:对于我们来说,需要定制的就直接编译,其余的一切皆yum / apt-get搞定 1.关闭iptables和SELinux [[email protected] ~]# service iptables stop [[email protected] ~]# setenforce 0 2

Centos 7.0 编译安装LAMP(Linxu+apache+mysql+php)之源码安装Mysql (二)

mysql 简介: MySQL是一个关系型数据库管理系统,关系数据库将数据保存在不同的表中,这样就增加了速度并提高了灵活性.目前其属于 Oracle 旗下产品.MySQL 是最流行的关系型数据库管理系统之一,在 WEB 应用方面,MySQL是最好的 RDBMS (Relational Database Management System,关系数据库管理系统) 应用软件.MySQL所使用的 SQL 语言是用于访问数据库的最常用标准化语言. 安装环境: 系统: centos 7.0 最小化安装 软件

实践作业之编译安装LAMP

题目1:httpd所支持的处理模型有哪些,他们的分别使用于哪些环境. (1)prefork模型: 功能:多进程模型,每个进程响应一个请求 工作方式: ①一个主进程:负责生成子进程及回收子进程(工作进程),负责创建套接字,负责接收请求,并将其派发给某子进程进行处理 ②n个子进程:每个子进程一个请求 主控进程会预先生成几个空闲子进程,随时等待用于响应用户请求.根据处理过程,可能会改变空闲进程的数量,需要定义最大空闲和最小空闲 (2)worker模型: 功能:多进程多线程模型,每个线程处理一个用户请求

ubuntu10.04编译安装LAMP

ubuntu10.04编译安装LAMP以及简单wordpress的使用 : http://linuxme.blog.51cto.com/1850814/971631 一.源码安装LAMP 网上有一堆关于介绍lamp的在这里我就不罗嗦了,直接上配置过程 1.apr包的安装 apr简介: The mission of the Apache Portable Runtime (APR) project is to create and maintain software libraries that

编译安装LAMP(两种场景)

编译安装LAMP 场景一:AP组合以模块方式结合(编译PHP作为httpd的模块):进而完成虚拟主机PMA(phpmyadmin)和discuz论坛 场景二:AP组合以fpm方式,PHP独立守护进程运行:进而完成虚拟主机PMA(phpmyadmin)和discuz论坛 ==========================场景一============================ 拓扑结构: 主机一 网卡1IP为172.20.1.100 网卡2IP为192.168.217.219 在此计算机上

编译安装 LAMP 平台

> 一.软件包 Linux:CentOS-6.4     Apache:httpd-2.4.9     MySQL:mysql-5.6.19     PHP:php-5.4.30 二.编译安装 httpd 在安装 httpd 之前,首先要安装两个依赖包:apr 和 apr-util.apr 是 apache portable runtime 的缩写,是 apache 提供的一个可以跨平台使用的 API.安装方法很简单,就是编译安装的三步骤: # apr tar xf apr-1.5.1.tar.