Installation of the software package is required to install Apr 1.5.2, Apr-util 1.5.4, and if you want to enable SSL you need to install the OpenSSL package,
1, install Apr because it is a compiled installation, see the relevant options through the./configure--help command.
[email protected] apr-1.5.2]# yum install-y gcc[[email protected] apr-1.5.2]#./configure--prefix=/usr/local/apr[[ Email protected] apr-1.5.2]# make & make Install
2, install the apr-util, you need to specify the installation location of APR, and the--prefix path
[Email protected] apr-util-1.5.4]#/configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/[[email Protected] apr-util-1.5.4]# make & make Install
3, install httpd2.4.23, need to install Pcre, Pcre-devel, if enable SSL need to install OpenSSL, Openssl-devel (version needs above 0.9.8a)
[Email protected] httpd-2.4.23]#/configure--prefix=/usr/local/httpd--sysconfdir=/etc/httpd--with-apr=/usr/ LOCAL/APR--with-apr-util=/usr/local/apr-util/--enable-ssl--enable-modules=all[[email protected] httpd-2.4.23]# Make & make Install
4, Configuration httpd
A, modify the environment variables
Create httpd.sh in/etc/profile/, add export path=/usr/local/httpd/bin: $PATH, (. /etc/profile.d/httpd.sh) Import environment variables.
b, include library file, create soft connection ln-sv/usr/local/httpd/include/usr/local/include/httpd.
C, edit the man configuration file, add the httpd help document, edit/etc/man.config Add the following Manpath/usr/local/httpd/man
D, because there is no service script, you can only perform startup using the Apachectl Start command.
If the following error occurs AH00558:httpd:Could not reliably determine the server's fully qualified domain name, using Localhost.localdomain . Set the ' ServerName ' directive globally to suppress this message, you need to edit httpd.conf add ServerName localhost (host name), and then reboot.
Ps-axu |grep httpd can see the process of httpd, open with a browser to see "It works!".
The service scripts are as follows:
#!/bin/bash# #description: httpd service#chkconfig: - 85 15. /etc/rc.d/init.d/ functionsif [ -f /etc/sysconfig/httpd ];then . /etc/sysconfig/ httpdfihttpd_lang=${httpd_lang-"C"}initlog_args= "" proc=httpdapachectl=/usr/local/httpd/bin/apachectlhttpd=${ httpd-/usr/local/httpd/bin/httpd}pidfile=${pidfile-/var/run/httpd/httpd.pid}lockfile=${lockfile-/var/lock/ Subsys/httpd}stop_timeout=${stop_timeout-10}retval=0start () {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 ${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 killproc -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=2 ;; esacexit $RETVAL
This completes the basic configuration.
This article is from the "10923086" blog, please be sure to keep this source http://10933086.blog.51cto.com/10923086/1877274
Centos 6 Compilation Installation Apache 2.4