(a) Introduction:
Apache is the world's largest web of useServersoftware. It can run in almost all of the widely usedComputer platformbecause of itsCross-platformand security are widely used, is one of the most popular Web server-side software. It is fast, reliable, and can be augmented with simple APIs toPerl/PythonwaitInterpretercompiled into the server. While Apache transliteration isApache, is a tribe of North American Indians, called the Apache tribe, in the southwest of the United States. is also the name of a foundation, aArmed helicoptersand so on.
(b) Installation Method | version
Installation method (1. Compile and install 2.rpm package installation)
Version (httpd-2.0 httpd-2.2 httpd-2.4 latest Version)
(iii) new features of httpd2.4:
1) MPM supports run-time loading
--enable-mpms-shared=all--with-mpm=prefork|worker|event
2) Support for event MPM
3) asynchronous read/write support
4) support for each module and each directory using different log levels
5) Support Per-request (i.e. support <if>, <elseif>, and <Else> condition judgment)
6) Enhanced version of the expression parser;
7) Support millisecond keepalive timeout;
8) The FQDN (domain name) based virtual host no longer needs namevirtualhost;
9) Support users to use custom variables;
New modules: mod_proxy_fcgi, Mod_ratelimit, Mod_request, Mod_remoteip
Note: Version 2.4 Modifies some configuration mechanisms: no longer supports the use of order, allow, deny to implement IP-based access control;
(iv) Compile and install:
Before compiling: Compiling a dependent development environment,Yum groupinstall development tools Server Platform development-y
Compile the trilogy: check the compilation environment, compile, install
compile and install Apr and Apr-util
Tar XF apr-1.5.0.tar.bz2
CD apr-1.5.0
./configure--PREFIX=/USR/LOCAL/APR
Make && make install
Tar XF apr-util-1.5.3.tar.bz2
CD apr-util-1.5.3
./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/
Make && make install
compiling and installing httpd2.4
CD httpd-2.4.9
./configure--prefix=/usr/local/apache--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=event && make && make install #编译模块
VIM/ETC/RC.D/INIT.D/HTTPD #提供服务脚本
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# Chkconfig:-85 15
# description:the Apache HTTP Server is an 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: $network $named $local _fs $remote _fs
# 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/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 would 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 this some modules may not
# work correctly with a thread-based MPM; Notably PHP would refuse to start.
# Path to the Apachectl script, server binary, and short-form for messages.
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}
# The semantics of these-functions differ from the the-the-same apachectl does
# Things--attempting to start while running is a failure, and shutdown
# When isn't running is also a failure. So we just do it the the-the-scripts
# is expected to behave here.
Start () {
Echo-n $ "Starting $prog:"
lang= $HTTPD _lang Daemon--pidfile=${pidfile} $httpd $OPTIONS
Retval=$?
Echo
[$RETVAL = 0] && Touch ${lockfile}
Return $RETVAL
}
# when stopping httpd, a delay (of default ten second) is required
# before sigkilling the httpd parent; This gives enough time for the
# httpd Parent to SIGKILL any errant children.
Retval=$?
Echo
[$RETVAL = 0] && Touch ${lockfile}
Return $RETVAL
}
# when stopping httpd, a delay (of default ten second) is required
# before sigkilling the httpd parent; This gives enough time for the
# httpd Parent to SIGKILL any errant children.
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 $ "not reloading due to configuration syntax error"
Failure $ "not reloading $HTTPD due to 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 were called.
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=2
Esac
Exit $RETVAL
(v) Launch test
Service httpd Start
(vi) HTTPD tools
The httpd command is an Apache HTTP server program.
parameter Description :
-C<HTTPD instruction > Execute the instruction in the option before reading the configuration file.
-C<HTTPD instruction > After reading the configuration file, execute the instructions in the options.
-d< the root directory of the server root > Specified server.
-d< Set File Parameters > Specify the parameters to pass in the configuration file.
-f< settings File > Specify configuration file.
-h displays Help.
-L Displays the modules that are included in the server compilation.
-L Displays a description of the HTTPD directive.
-S displays the settings in the configuration file.
-T The syntax for the test configuration file is correct.
-V Displays version information.
-V Displays version information and establishes the environment.
-X starts the server in a single program.
Compiling and installing httpd-2.4.9