Linux under Compile and install Apache and modules

Source: Internet
Author: User

Apache is one of the most popular Web server-side software that uses a very extensive web server, multi-platform support. Apache is fast, reliable, and can be augmented with a simple API to integrate language interpreters such as Php/python. This article explains how to compile Apache under Linux and how to compile the Apache module.
Linux under Compile ApacheTo download the Apache source code, compile the process as follows:
$ wget http://apache.fayea.com//httpd/httpd-2.4.12.tar.gz $ tar-zxf httpd-2.4.12.tar.gz $ cd httpd-2.4.12
$./configure--prefix=/usr/local/apache/ $ make && make install

During the compilation process, the following error may occur:
$ ./configure--prefix=/usr/local/apache/checking for chosen layout ... Apachechecking for working mkdir-p ... yeschecking for grep that handles long lines and-e .../bin/grepchecking for egrep .../bin/grep-echecking build system type ... X86_64-unknown-linux-gnuchecking host system type ... X86_64-unknown-linux-gnuchecking target system type ... X86_64-unknown-linux-gnuConfigure:configure:configuring Apache Portable Runtime Library ...Configure:Checking for APR ... noConfigure:error:APR not found. Please read the documentation.
this is because Apache compilation relies on Apr and cannot be installed without the APR being found. In addition, Apache relies on Apr-util andPcre
compiling Apache dependenciesApr isThe Apache portable runtime, which encapsulates all operating system calls, is used to enable Apache internal components to use operating system resources and improve Apache portability. Apr and Apache are separated to avoid the Apache development process, but also for different platforms to do different processing. Apr-util is equivalent to the APR toolset. Pcre is the Perl library that implements the regular.
compiling and installing APR
$ wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz $ tar-zxf apr-1.5.2.tar.gz $ cd apr-1.5.2 $./configure--prefix=/usr/local/apr $ make && make install

compiling and installing Apr-util
$ wget http://archive.apache.org/dist/apr/apr-util-1.5.3.tar.gz $ tar-zxf apr-util-1.5.3.tar.gz $ cd apr-util-1.5.3 $./configure--prefix=/usr/local/apr-util--WITH-APR=/USR/LOCAL/APR $ make && make install

compiling and installing Pcre
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz $ tar-zxf pcre-8.37.tar.gz $ cd pcre-8.37 $./configure--prefix=/usr/local/pcre $ make && make install

Recompile ApacheAfter installing Apache dependencies, compile with a few more parameters and recompile Apache
$./configure--prefix=/usr/local/apache/\ --with-apr=/usr/local/apr \ --with-apr-util=/usr/local/apr-util \ --with-pcre=/usr/local/pcre $ make && make install

compiling the Apache moduleHere is an example of MOD_CONCATX, which shows how to compile the Apache module with a simple procedure.Mod_concatx isApache module, can be used to combine multiple js/css, effectively improve js/css loading speed compiling the Mod_concatx module
$ wget http://apmod.googlecode.com/svn/trunk/mod_concatx/mod_concatx.c $ ln-s/usr/local/apache/bin/apxs/usr/local/bin/apxs $ apxs-c mod_concatx.c

compiling and installing the MOD_CONCATX module
$ apxs-iac mod_concatx.c
This compilation will automatically install the Apache module, after successful installation, you can find mod_concatx.so in the Apache module directory, and the conf/httpd.conf configuration will also addMOD_CONCATX Module Information
launch Apache
$/usr/local/apache/bin/httpd-k Start
NOTE: After Apache is started, it is run as a service. If you want to turn Apache off, use the following command:
$/usr/local/apache/bin/httpd-k Stop

viewing the loaded Apache modules
$/usr/local/apache/bin/httpd-m
Loaded Modules:
Core_module (Static)
So_module (Static)
Http_module (Static)
Mpm_event_module (Static)
Authn_file_module (Shared)
Authn_core_module (Shared)
Authz_host_module (Shared)
Authz_groupfile_module (Shared)
Authz_user_module (Shared)
Authz_core_module (Shared)
Access_compat_module (Shared)
Auth_basic_module (Shared)
Reqtimeout_module (Shared)
Filter_module (Shared)
Mime_module (Shared)
Log_config_module (Shared)
Env_module (Shared)
Headers_module (Shared)
Setenvif_module (Shared)
Version_module (Shared)
Unixd_module (Shared)
Status_module (Shared)
Autoindex_module (Shared)
Dir_module (Shared)
Alias_module (Shared)
concatx_module (Shared)
Description MOD_CONCATX is loaded!
Reference: http://blog.csdn.net/mycwq/article/details/46426261

Linux under Compile and install Apache and modules

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.