Compile and install Apache

Source: Internet
Author: User
Tags fully qualified domain name

Tag: Compile and install Apache

First, the preparatory work

Second, compile and install

Third, the related file path configuration

Four, the main configuration file common configuration information detailed

First, the preparatory work

Install the compilation environment

Yum Groupinstall "Development tools"

Download the required files

[[email protected] ~]# mkdir downloads[[email protected] ~]# CD Downloads/[[email protected] downloads] #wget Http://mirro R.bit.edu.cn/apache/httpd/httpd-2.4.12.tar.gz[[email protected] downloads] #wget http://mirror.bit.edu.cn/apache/ Apr/apr-1.5.2.tar.gz[[email protected] downloads] #wget http://mirror.bit.edu.cn/apache/apr/apr-util-1.5.4.tar.gz[ [Email protected] downloads]# lsapr-1.5.2.tar.gz apr-util-1.5.4.tar.gz httpd-2.4.12.tar.gz

Unzip the file

[Email protected] downloads]# TAR-XF httpd-2.4.12.tar.gz [[email protected] downloads]# TAR-XF apr-1.5.2.tar.gz [[email] Protected] downloads]# TAR-XF apr-util-1.5.4.tar.gz

Second, compile and install

CD to the source folder, you can use the #./configure--help to get the compilation help

(1), compile and install Apr,apr-util, compile and install httpd2.4 need newer version Apr and Apr-util

[Email protected] apr-1.5.2]# CD Apr-1.5.2[[email protected] apr-1.5.2]#./configure--prefix=/usr/local/apr[[email Protected] apr-1.5.2]# make && make Install[[email protected] apr-1.5.2]# cd/root/downloads/apr-util-1.5.4[[ 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


After the following command finishes executing

./configure--PREFIX=/USR/LOCAL/APR

Results hint cannot remove ' libtoolt ': No such file or directory

To resolve the editing configure, comment out $RM "$cfgfile".


(2), compile and install httpd

[[email protected] apr-util-1.5.4]# cd /root/downloads/httpd-2.4.12[[email protected]  httpd-2.4.12]# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd -- enable-so --enable-ssl --enable-cgi --enable-cgid --enable-modules=most -- Enable-mods-shared=most --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr  --with-apr-util=/usr/local/apr-util --enable-mpms-shared=all --with-mpm=worker[[email  Protected] httpd-2.4.12]# make hint configure: error: pcre-config for libpcre  not found. pcre is required and available from http://pcre.org/Solve, Install ahead of time next compile [[Email protected] httpd-2.4.12]# yum install pcre-devel -y again make, Hint Checking whether to enable mod_ssl... configure: error: mod_ssl has  been requested but&nbspThe Can not be built due to prerequisite failures solution requires MOD_SSL module support and relies on its development components [[ Email protected] httpd-2.4.12]# yum install -y openssl-devel make again, succeed, and then install [[ Email protected] httpd-2.4.12]# make install

./configure related options,--enable-mpms-shared=all, so that the event, worker, Prefork will be installed in a modular manner, where the--with-mpm=worker settings enable the worker module, Others are configured as needed in the httpd.conf.

--SYSCONFDIR=/ETC/HTTPD: Specify the configuration file installation location--enable-so: Support Dynamic sharing module If you do not have this module PHP will not work with Apache--enable-ssl: Kai Support ssl--enable-cgi: Support cgi--enable-rewrite: Support URL rewrite--with-zlib: Compress library, can save bandwidth when propagating on Internet--with-ap R=/USR/LOCAL/APR: Specify Apr path--with-apr-util=/usr/local/apr-util: Specify Apr-util path--enable-mpms-shared=all: Supports multi-channel processing module--with-mpm=event: Set the default module

Third, the related file path configuration

(1), add the service program path to the PATH environment variable

New/etc/profile.d/apache.sh, add content save exit, source a bit

Export path= $PATH:/usr/local/apache/bin

(2), add library file search path

New/etc/ld.so.conf.d/apache.conf, adding content

/etc/ld.so.conf.d/apache.conf

(3), add header file path

[Email protected] profile.d]# LN-SV/USR/LOCAL/APACHE/INCLUDE/USR/INCLUDE/HTTPD

(4), add Man manual path

Edit "Manpath=" in the/etc/man.config file

Manpath/usr/local/apache/share/man

(5), copy the service script to the/ETC/INIT.D directory

[Email protected] apache]# CP/USR/LOCAL/APACHE/BIN/APACHECTL/ETC/INIT.D/HTTPD

(6), there is a need to modify the next/etc/init.d/httpd

apachectl=/usr/local/apache/bin/apachectlhttpd=${httpd-/usr/local/apache/bin/httpd}pidfile=${pidfile-/usr/ Local/apache/logs/httpd.pid}

(7), add httpd to the service list, set the boot up, and start the service

[[email protected] apache]# chkconfig--add httpd[[email protected] apache]# chkconfig httpd on[[email protected] apache]# Service httpd Start


If you have the following tips

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

Edit/etc/httpd/httpd.conf, Search/ServerName, navigate to #servername www.example.com:80, modify and enable it, as

ServerName localhost:80

Complete the above configuration, you can test with the browser, in the "It works! "Show Apache working properly

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/6D/12/wKiom1VbODyzasWcAAB4QWh2Jac283.jpg "height="/>

Four, the main configuration file common configuration information detailed

http://64314491.blog.51cto.com/2784219/1652056

This article is from the "Arvin Lau" blog, be sure to keep this source http://64314491.blog.51cto.com/2784219/1652948

Compile and install Apache

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.