cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Cloud



Etc


Reference














.

middleware:web:httpd:install:compile2.4.html



Apache HTTP Server Configuration Examples

Apache Http Server : Compiling and Installing Version 2.4

Requirements

APR and APR-Util (Apache Portable Runtime)

Make sure you have APR and APR-Util already installed on your system. If you don't, or prefer to not use the system-provided versions,
download the latest versions of both APR and APR-Util from Apache APR,
unpack them into /httpd_source_tree_root/srclib/apr and /httpd_source_tree_root/srclib/apr-util
(be sure the directory names do not have version numbers; for example, the APR distribution must be under /httpd_source_tree_root/srclib/apr/)
and use ./configure's –with-included-apr option.

Compile Tools

# yum install gcc make pcre pcre-devel 


Procedure

Download and Unpachage

# curl -O http://XXXXX/httpd-2.4.N.tar.bz2
# curl -O http://xxxxx/apr-1.5.2.tar.bz2
# curl -O http://xxxxx/apr-util-1.5.4.tar.bz2

# tar jxf httpd-2.4.N.tar.bz2
# tar jxf apr-1.5.2.tar.bz2
# tar jxf apr-util-1.5.4.tar.bz2

# mv apr-1.5.2 httpd-2.4.23/srclib/apr
# mv apr-util-1.5.4 httpd-2.4.23/srclib//apr-util

configure and make

# cd httpd-2.4.N
# ./configure --prefix=/usr/local/apache-2.4.N --with-included-apr
# make
# make install
# cd /usr/local
# ln -s apache-2.4.N apache2
# cd /usr/local/apache2/bin/
# apachectl -k start


# apachectl -k stop
# ./apachectl -h
Usage: /usr/local/apache-2.4.23/bin/httpd [-D name] [-d directory] [-f file]
                                          [-C "directive"] [-c "directive"]
                                          [-k start|restart|graceful|graceful-stop|stop]
                                          [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]


Configure Options

http://httpd.apache.org/docs/2.4/en/programs/configure.html

-h
--help [short|recursive]
    Output the help and exit. 

--prefix=PREFIX
    Install architecture-independent files in PREFIX. By default the installation directory is set to /usr/local/apache2.

  --with-included-apr     Use bundled copies of APR/APR-Util


Tips

How can you know the Apache configuration options that are installed?

Check config.log

# cat config.log  |head -n 25
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure --prefix=/usr/local/apache-2.4.23 --with-included-apr

## --------- ##
## Platform. ##
## --------- ##

hostname = centos7
uname -m = x86_64
uname -r = 3.10.0-229.el7.x86_64
uname -s = Linux
uname -v = #1 SMP Fri Mar 6 11:36:42 UTC 2015

/usr/bin/uname -p = x86_64
/bin/uname -X     = unknown

/bin/arch              = x86_64
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown

(abbr)


How do I use compiled Apache httpd with systemd?

/usr/lib/systemd/system/httpd.service

[Unit]
Description=The Apache HTTP Server

[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/httpd
PIDFile=/var/apache/httpd.pid
ExecStart=/usr/apache/bin/apachectl start
ExecReload=/usr/apache/bin/apachectl graceful
ExecStop=/usr/apache/bin/apachectl stop
KillSignal=SIGCONT
PrivateTmp=true


[Install]
WantedBy=multi-user.target



middleware/web/httpd/install/compile2.4.html.txt · Last modified: 2017/05/06 by admin

Page Tools