Apache static Compilation and dynamic compilation detailed

Source: Internet
Author: User
Tags connection pooling ldap locale

Apache has a 4-layer structure, from the core to the outer module. The outer module can work with Apache in both static and dynamic ways. This also introduces the following "dynamic" and "static" two ways of compiling the installation:

Static compilation:

Compile, all the modules themselves compiled into httpd This file, when the Apache launched the module has been loaded in, you can directly use, and no longer httpd.conf in the LoadModule to be loaded, as long as it is configured in <ifmodule></ifmodule> .

Dynamic compilation:

When compiling, use enable-module=shared or enable-mods-shared=module to compile dynamically. The dynamic is obviously not compiled into the httpd inside, the boot time will not load this module, but to give you a module.so file. You want to use it, just use the loadmodule syntax to load it in httpd.conf, this module works.

The difference is:

Static modules are usually configured with <ifmodule></ifmodule> in http.conf, dynamically loadmoule to load first, and then <ifmodule></ifmodule> Configuration.

Officials say static is about 5% more in performance than dynamic.

Relatively speaking, static efficiency is higher, and dynamic mode configuration is flexible. Think of the compiled C this module you want to upgrade or remove, static mode can only recompile Apache.

The following sentence runs under the Apache source folder and can be viewed by default Apache has loaded those module into you:

./configure–help | grep disable

Allow Apache to dynamically compile and load modules in the future:

If you want Apache to be able to support dynamic compilation (DSO) more modules in the future, you need to compile the so module to the core at the initial installation (i.e., static compilation ).

If any DSO modules are included in the compilation, the Mod_so will be automatically included in the core. If you want the core to be able to mount the DSO later, but do not actually compile any DSO modules, you need to specify explicitly:

For apache1.x: --enable-module=so

For apache2.x: --enable-so=static

Types of Apache modules:

The basic (B) module is included by default and must be explicitly disabled;

The extension (E)/Experiment (X) module is not included by default and must be explicitly enabled.

So, for these types of modules, there are several ways to do this:

--disable-module

Disabling module modules (for basic modules only)

--enable-module=shared

Compile module as DSO (available for all modules)

--enable-module=static

Statically connecting module to the core (for expansion and experimental modules only)

--enable-mods-shared=module-list

Compile all modules in Module-list into DSO (available for all modules)

--enable-modules=module-list

Static connection of the module-list into the core (available for all modules)

There are two lazy methods for--enable-modules and--enable-mods-shared that are the most and all parameters, which represent "many" and "all", respectively.

For example:

Mod_alias is a basic module, do not want to install the words: --disable-alias

Mod_rewrite is an extension module that wants to load it dynamically:--enable-rewrite=shareD, want to load statically is:--enable-rewrite=static

Want to statically compile Mod_alias and mod_rewrite:--enable-modules= ' Alias rewrite '

Want to dynamically compile Mod_alias and mod_rewrite:--enable-mods-shared= ' Alias rewrite '

Some examples of apache2.2.x:

Maximizing the static installation of Apache:

./configure--prefix=/usr/local/apache--enable-modules=all

Maximizing the dynamic installation of Apache:

./configure--prefix=/usr/local/apache--enable-mods-shared=all

Static installation rewrite, dynamic installation deflate, and headers

./configure--prefix=/usr/local/apache--enable-rewrite=static--enable-deflate=shared--enable-headers=shared

Does not install the basic Alais, retains the later expansion DSO ability:

./configure--prefix=/usr/local/apache--enable-so=static--disable-alias

In the Apache source directory, run the command ./configure-help can view all compilation parameters explained

[[email protected] ~]# cd/usr/local/src/httpd-2.2.22[[email protected] httpd-2.2.22]#./configure-help ' Configure ' configures this package to adapt to many kinds of systems. Usage:./configure [OPTION] ... [Var=value] ...  To assign environment variables (e.g., CC, CFLAGS ...), specify them asvar=value. See below for descriptions of some of the useful variables. Defaults for the options is specified in brackets. Configuration:-H,--help display this Help and exit--help=short display options specific to th Is package--help=recursive display the short help of all the included Packages-v,--version display V Ersion information and Exit-q,--quiet,--silent do not print ' checking ... ' Messages--cache-file=file cache Te St results in FILE [disabled]-C,--config-cache alias for '--cache-file=config.cache '-N,--no-create do n OT Create output files--srcdir=dir find the sources in dir [Configure DIR or '..‘]                          Installation directories:--prefix=prefix install architecture-independent files in prefix                          [/usr/local/apache2]--exec-prefix=eprefix install architecture-dependent files in Eprefix [PREFIX]  By default, ' make install ' would install all of the files in '/usr/local/apache2/bin ', '/usr/local/apache2/lib ' etc. You can Specifyan installation prefix other than '/usr/local/apache2 ' using '--prefix ', for instance '--prefix= $HOME '. For better control, use the options below.           Fine tuning of the installation directories:--bindir=dir user executables [Eprefix/bin]--sbindir=dir System admin Executables [Eprefix/sbin]--libexecdir=dir program executables [eprefix/libexec]--sysconfdir=d IR read-only single-machine data [prefix/etc]--sharedstatedir=dir modifiable architecture-independent data [PR Efix/com]--localstatedir=dir modifiable single-machine data [Prefix/var]--libdir=dir obJect code libraries [Eprefix/lib]--includedir=dir C header files [prefix/include]--oldincludedir=dir c head ER files for NON-GCC [/usr/include]--datarootdir=dir read-only arch.-independent data root [Prefix/share]--datad Ir=dir read-only architecture-independent data [datarootdir]--infodir=dir info documentation [DATARO  Otdir/info]--localedir=dir locale-dependent data [Datarootdir/locale]--mandir=dir man documentation [Datarootdir/man]--docdir=dir documentation root [datarootdir/doc/package]--htmldir=dir HTML doc umentation [Docdir]--dvidir=dir DVI documentation [DOCDIR]--pdfdir=dir PDF documentation [Docdir ]--psdir=dir PS Documentation [DOCDIR]SYSTEM types:--build=build Configure for building on build [gues SED]--host=host cross-compile to build programs to run on host [build]--target=target configure for building C Ompilers for TARGET [HOST]optional Features:--disable-option-checking Ignore unrecognized--enable/--with options--disable-feature do n OT include FEATURE (same as--enable-feature=no)--enable-feature[=arg] include FEATURE [Arg=yes]--enable-layout=layou T--enable-v4-mapped allow IPV6 sockets to handle IPV4 connections--enable-exception-hook enable fatal exception H            Ook--enable-maintainer-mode Turn on debugging and compile time warnings--enable-pie Build httpd as a Position independent executable--enable-modules=module-list space-separated List of modules to enable |                          "All" |                          "Most"--enable-mods-shared=module-list space-separated LIST of GKFX modules to enable | "All" | "Most"--disable-authn-file file-based authentication control--enable-authn-dbm dbm-based authentication contro L--enable-authn-anon Anonymous user authenticationControl--ENABLE-AUTHN-DBD sql-based Authentication Control--disable-authn-default Authentication Backstopper--E Nable-authn-alias Auth Provider alias--disable-authz-host host-based authorization Control--DISABLE-AUTHZ-GROUPF Ile ' require group ' authorization control--disable-authz-user ' require user ' authorization C Ontrol--enable-authz-dbm dbm-based Authorization control--enable-authz-owner ' require File-owner ' authorizatio N Control--enable-authnz-ldap LDAP based authentication--disable-authz-default authorization Control Backstopper-          -disable-auth-basic Basic Authentication--enable-auth-digest RFC2617 Digest authentication--enable-isapi ISAPI Extension support--enable-file-cache file cache--enable-cache Dynamic file caching--enable-disk -cache Disk caching module--enable-mem-cache memory caching module--ENABLE-DBD Apache dbd framewor   K--enable-bucketeer   Buckets Manipulation Filter--enable-dumpio I/O dump filter--enable-echo echo Server--enable-exa Mple Example and Demo module--enable-case-filter example uppercase conversion filter--enable-case-filter-in Example uppercase conversion input filter--enable-reqtimeout Limit time waiting for request from client--enable-ex   T-filter External Filter Module--disable-include Server Side includes--disable-filter Smart Filtering --enable-substitute response content Rewrite-like filtering--disable-charset-lite character Set translation--en           Able-charset-lite Character set translation--enable-deflate deflate transfer encoding support--ENABLE-LDAP    LDAP Caching and connection Pooling services--disable-log-config logging configuration--enable-log-forensic Forensic logging--enable-logio input and output logging--disable-env clearing/setting of env var  S--enable-mime-magic   automagically determining MIME type--enable-cern-meta cern-type meta files--enable-expires expires head ER control--enable-headers HTTP header control--enable-ident RFC 1413 identity Check--enable-usertra CK user-session Tracking--enable-unique-id per-request unique IDs--disable-setenvif basing ENV VARs on Headers--disable-version determining httpd version in config files--enable-proxy Apache proxy module-     -enable-proxy-connect Apache proxy connect module--enable-proxy-ftp Apache Proxy FTP module--enable-proxy-http Apache Proxy HTTP module--enable-proxy-scgi Apache proxy scgi module--ENABLE-PROXY-AJP Apache proxy ajp mo Dule--enable-proxy-balancer Apache Proxy balancer Module--ENABLE-SSL SSL/TLS support (MOD_SSL)--enable-di Stcache Select distcache Support in Mod_ssl--enable-optional-hook-export example optional Hook exporter--enable-Optional-hook-import Example optional Hook importer--enable-optional-fn-import Example Optional function Importer--enable-optional-fn-export example optional functio N Exporter--enable-static-support Build a statically linked version of the support binaries--                          ENABLE-STATIC-HTPASSWD Build a statically linked version of HTPASSWD--enable-static-htdigest                          Build a statically linked version of Htdigest--enable-static-rotatelogs Build a statically linked version of Rotatelogs--enable-static-logresolve build a statically Li nked version of Logresolve--enable-static-htdbm Build a statically linked version of HTDBM--enable-static-ab Bu  ILD a statically linked version of AB--enable-static-checkgid Build a statically linked version of Checkgid--enable-sTatic-htcacheclean Build a statically linked version of Htcacheclean--ENABLE-STATIC-HTTXT2DBM Build a statically linked version of HTTXT2DBM--enable-http HTTP protocol Handling-- Disable-mime mapping of File-extension to MIME--enable-dav WebDAV protocol handling--disable-statu s process/thread Monitoring--disable-autoindex directory listing--disable-asis as-is filetypes--          Enable-info Server information--enable-suexec set UID and GID for spawned processes--disable-cgid CGI scripts--enable-cgi CGI scripts--disable-cgi CGI scripts--enable-cgid CGI   Scripts--enable-dav-fs DAV provider for the filesystem--enable-dav-lock DAV provider for generic locking           --enable-vhost-alias mass Virtual Hosting module--disable-negotiation content negotiation--disable-dir Directory Request HandLing--enable-imagemap server-side imagemaps--disable-actions Action triggering on requests--enable-speli ng correct common URL misspellings--disable-userdir mapping of requests to user-specific directories--dis  Able-alias mapping of requests to different filesystem parts--enable-rewrite rule based URL manipulation --enable-so DSO capabilityoptional Packages:--with-package[=arg] Use package [Arg=yes]--without-packag Same as--with-package=no--WITH-INCLUDED-APR use bundled copies of Apr/apr-util--with -apr=path prefix for installed Apr or the full PATH to Apr-config--with-apr-util=pat H prefix for installed Apus or the full path to Apu-config--with-pcre=path use Exte Rnal PCRE Library--with-port=port port on which to listen (default was)--with-sslport=sslport port on which To Securelisten (default is 443)--with-z=dir use a specific zlib library--with-sslc=dir RSA ssl-c SSL/TLS Toolkit--with-s                          Sl=dir OpenSSL SSL/TLS Toolkit--WITH-MPM=MPM Choose the process model for Apache to use.                          MPM={BEOS|EVENT|WORKER|PREFORK|MPMT_OS2|WINNT}--with-module=module-type:module-file  Enable Module-file in the modules/<module-type> directory.    --with-program-name Alternate executable name--with-suexec-bin Path to suexec binary--with-suexec-caller User allowed to call suexec--with-suexec-userdir user subdirectory--with-suexec-docroot suexec root directory--w Ith-suexec-uidmin Minimal allowed UID--with-suexec-gidmin Minimal allowed GID--with-suexec-logfile Set the log File--with-suexec-safepath Set the Safepath--with-suexec-umask umask for suEXEC ' d processsome influential environ ment variables:cc C compiler command CflagS C Compiler flags LDFLAGS linker flags, e.g.-l<lib dir> if you had libraries in a Nonstand ARD directory <lib dir> LIBS libraries to pass to the linker, e.g.-l<library> cppflags C/c++/obje Ctive C preprocessor flags, e.g.-i<include dir> If you had headers in a nonstandard directory <inc Lude dir> CPP C preprocessoruse These variables to override the choices made by ' configure ' or to Helpit to fi ND libraries and programs with nonstandard names/locations. Report bugs to the package provider.  [[email protected] httpd-2.2.22]#

Apache static Compilation and dynamic compilation detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.