The source code of the CentOS lamp is compiled and installed httpd

Source: Internet
Author: User

1 It is best to install the components first

[[email protected] ~]# Yum Groupinstall additional development[[email protected] ~]# Yum groupinstall development tool


2 Installing AP1.5.2R (Apache portable Runtime), installing the Apr-util 1.5.4 tool

[Email protected] ~]wget http://mirrors.cnnic.cn/apache//apr/apr-1.5.2.tar.gz[[email protected] ~]# tar XZVF Apr-1.5.2.tar.gz[[email protected] apr-1.5.2]#./configure--prefix=/usr/local/apr/

If error: Rm:cannot remove ' libtoolt ': No such file or directory, please edit configure this file, will $RM "$cfgfile" that line comment out

[[email protected] apr-1.5.2] #make &&make Install


Installing the Apr-util tool

[Email protected] ~]wget http://mirrors.cnnic.cn/apache//apr/apr-util-1.5.4.tar.gz

Compile Options note the--APR option

[Email protected] ~]# tar XF apr-util-1.5.4.tar.gz[[email protected] ~]# CD 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


3 CentOS has Pcre installed by default, so you do not need to install PCRE, otherwise install


4 Installation httpd 2.4.12 (2015-6-6 new)

[[Email protected] ~]# tar XF httpd-2.4.12.tar.bz2[[email protected] ~]# CD httpd-2.4.12

Plan to compile the option Plus (note the ambiguous view./configure-h do not write, finish and your own control, whether there is a problem)

Basic options, including installation path, configuration file path

--prefix=/usr/local/apache specifying the large path of the installation

--SYSCONFDIR=/ETC/HTTPD specifying the path to the configuration file

Modules allow options, allow modules to be used, most dynamically allow MPM, etc.

--ENABLE-SO allows modular use of

--enable-modules=most adding most of the modules

--enable-mods-shared=most

--enable-mpms-shared=all support for all MPM models

--ENABLE-CGI--enable-cgid Support CGI programs

--ENABLE-SSL supports HTTPS with SSL support

--enable-rewrite Support for URL redirection

Specify and bind to the Apr,apr-util

--with-include-apr

--with-apr=/usr/local/apr Specify Apr

--with-apr-util=/usr/local/apr-util Specifying Apr-util

[Email protected] httpd-2.4.12]#/configure--prefix=/usr/local/apache--sysconfdir=/etc/httpd--enable-so-- Enable-modules=most--enable-mods-shared=most--enable-mpms-shared=all--enable-cgi--enable-cgid--enable-ssl-- Enable-rewrite--with-include-apr--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util[[email protected] HTTPD-2.4.12] #make &&make Install

Compile and install finished

Enter the post-installation directory

[[email protected] bin]# cd/usr/local/apache[[email protected] apache]# lsbin build cgi-bin error htdocs icons incl Ude Logs man manual modules[[email protected] apache]# CD Bin/[[email protected] bin]#./apachectl

Then open the Web page to try, enter your virtual machine IP can

If you cannot open it, consider the following

[[Email protected] bin]# service iptables stop[[email protected] bin]# getenforceenforcing[[email protected] bin]# SETENF Orce 0[[email protected] bin]# vim/etc/selinux/config

Change to Permissive

Modify folder Properties

[[email protected] bin] #chmod 755/usr/local/apache/

Try to refresh again


Above the good, the webpage appears it works! After

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/0A/wKioL1VyhjiytIkYAADLGNlNx_4606.jpg "/>

We can copy the command to/ETC/INIT.D/HTTPD to implement the service call, in short, all in order to implement before using httpd RPM package that habit, hey

[Email protected] bin]# cp/root/httpd-2.4.12/build/rpm/httpd.init/etc/init.d/httpd[[email protected] bin]# chmod +x/ Etc/init.d/httpd

Modify a file

Suggested three places

    1. HTTPD=${HTTPD-/USR/LOCAL/APACHE/BIN/HTTPD}

    2. Pidfile=${pidfile-/var/run/httpd/${prog}.pid}

    3. Conffile=/etc/httpd/httpd.conf



Don't rush to enable the service

Create the appropriate directory

[Email protected] bin]# mkdir/var/run/httpd/

In order to use HTTPD-T and other commands, modify the ~/.bash_profile

Modified to path= $PATH: $HOME/bin:/usr/local/apache/bin

[Email protected] bin]# vim ~/.bash_profile [[email protected] bin]# source ~/.bash_profile [[email protected] bin]# HTT Pd-tsyntax OK



Add this line to/etc/httpd/httpd.conf.

Pidfile "/var/run/httpd/httpd.pid"

Create a compliant link for the log file

[Email protected] bin]# ln-s/usr/local/apache/logs/*/var/log/httpd/

Then restart the service to see if OK

If not, check the log file, etc.

[[Email protected] bin]# service httpd restartstopping httpd: [OK]starting HT TPD: [OK]

Then check again to see if the page is normal, and finally build up the latest httpd2.4.12 task has been completed!


This article is from the "Learning Path of Kai Learning" blog, please make sure to keep this source http://qixue.blog.51cto.com/7213178/1659167

The source code of the CentOS lamp is compiled and installed httpd

Related Article

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.