Original link: http://www.2cto.com/os/201511/450258.html
##### Apache compilation installation [[email protected] ~]# Yum install gcc gcc-c++ make wget
[[email protected] ~]# yum install zlib-devel openssl-devel [[email protected] ~]# yum install-y perl perl-deve L 1) apr[[email protected] src]# wget http://mirror.bit.edu.cn/apache//apr/apr-1.5.2.tar.gz[[email Protected] src]# tar zxvf apr-1.5.2.tar.gz[[email protected] src]# CD apr-1.5.2[[email protected] apr-1.5.2] #./configure--prefix=/usr/local/apache/apr[[email protected] apr-1.5.2]# make && make install 2) Apr-util[[email protected] src]# wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.4.tar.gz[[email protected] src]# tar zxvf apr-util-1.5.4.tar.gz[[email protected] src]# CD apr-util-1.5.4[[email Protected] apr-util-1.5.4]#./configure--prefix=/usr/local/apache/apr-util--with-apr=/usr/local/apache/apr[[ Email protected] apr-util-1.5.4]# make && make install 3) pcre[[email protected] src]# wget ftp://ftp. Csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz[[email protected] Src]# tar zxvf pcre-8.37.tar.gz[[email protected] src]# CD pcre-8.37[[email protected] pcre-8.37]#./configure [[email protected] pcre-8.37]# make && make install 4) apache[[email protected] ~]# cd/usr/local/src/ [[email protected] ~]# wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.17.tar.gz[[email protected] src]# tar zxvf httpd-2.4.17.tar.gz[[email protected] src]# CD httpd-2.4.17[[email protected] httpd-2.4.17]# ./configure--prefix=/usr/local/apache--with-apr=/usr/local/apache/apr/bin/apr-1-config--with-apr-util=/usr/ Local/apache/apr-util/bin/apu-1-config--enable-module=so--enable-mods-shared=all--enable-deflate-- Enable-expires--enable-headers--enable-cache--enable-file-cache--enable-mem-cache--enable-disk-cache-- Enable-mime-magic--enable-authn-dbm--enable-vhost-alias--enable-so--enable-rewrite--enable-ssl--with-mpm= Prefork [[email protected] httpd-2.4.17]# make && make install #index. Php#addhandler pHp5-script. Php#addtype text/html. php###### httpd End ########### [[email protected] ~]# ln-s/usr/local/apache/c Onf/etc/httpd[[email protected] ~]# ln-s/usr/local/apache/bin/*/usr/sbin/[[email protected] ~]# touch/ Etc/init.d/httpd[[email protected] ~]# chmod 755/etc/init.d/httpd [[email protected] ~]# vi/etc/init.d/ httpd#!/bin/bash## httpd Startup script for the Apache HTTP server## chkconfig:-15# description:the Apache HT TP server is a efficient and extensible # Server implementing the current HTTP standards.# 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:the Apache http Server is an Extensible Server # Implementing the CURRent HTTP standards.### END INIT INFO # Source function library: /etc/rc.d/init.d/functionsif [-F/ETC/SYSCONFIG/HTTPD]; Then. /etc/sysconfig/httpdfihttpd_lang=${httpd_lang-"C"}initlog_args= "" apachectl=/usr/sbin/apachectlhttpd=${httpd-/ usr/sbin/httpd}prog=httpdpidfile=${pidfile-/usr/local/apache/logs/httpd.pid}lockfile=${lockfile-/var/lock/ Subsys/httpd}retval=0stop_timeout=${stop_timeout-10}start () {echo-n $ "starting $prog:" lang= $HTTPD _lang D Aemon--pidfile=${pidfile} $httpd $OPTIONS retval=$? echo [$RETVAL = 0] && Touch ${lockfile} return $RETVAL}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 to configuration syntax error" failure $"Not reloading $httpd due-to-configuration syntax error" Else # force LSB behaviour from Killproc lsb=1 K Illproc-p ${pidfile} $httpd-hup retval=$? If [$RETVAL-eq 7]; Then failure $ "httpd shutdown" fi fi echo}case "$" in start) start; stop) stop;; Status) status-p ${pidfile} $httpd retval=$? ;; restart) stop start;; Condrestart|try-restart) if Status-p ${pidfile} $httpd >&/dev/null; Then stop start fi;; Force-reload|reload) reload;; Graceful|help|configtest|fullstatus) $apachectl [email protected] retval=$? ;; *) echo $ "Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful| Help|configtest} "Retval=2esacexit $RETVAL [[email protected] ~]# chkconfig--add httpd[[email protected] ~] # Chkconfig httpd on
Restart
Service Httpd-k Restart
linux--Building PHP Development Environment First step: Apache