Apache httpd-2.4.10 Compile and install

Source: Internet
Author: User
Tags fully qualified domain name

System: centos6.5_64

Software: httpd-2.4.10.tar.bz2

Dependencies: openssl-1.0.1j.tar.gz, apr-1.5.1.tar.bz2, apr-util-1.5.4.tar.bz2, Pcre-devel

: Http://www.openssl.org/source/openssl

: http://httpd.apache.org/download.cgi httpd

Download Underground: http://apr.apache.org/download.cgi Apr,apr-util is an Apache project

Pcre-devel on our system installation CD.


First, let's start by stating that we have installed the basic development package.

The APR and OpenSSL are already installed on our system, but the versions are too low and they are dependent on other software, so you can only compile and install the new version without affecting the other software. And the original httpd will also be dependent on other software, can not be uninstalled.


1. Install the Pcre-devel first, and the Yum directly.

Yum Install pcre-devel-y #-y is the direct installation meaning, to me before even y do not know.

2. Install apr-1.5.1, this version I downloaded yesterday, is now the latest version. The lower version will not install the event module.

./configure--prefix=/usr/local/apr1.5 #只来个安装位置就可以make && make install #稍等片片刻.

3. Install the apr-util-1.5.4.

./configure--prefix=/usr/local/apr1.5--with-apr=/usr/local/apr1.5# This is the APR toolset, which relies on the APR above, So add--with to specify the directory where we install Apr. #跟apr安装在一个目录, there seems to be no problem now. Make && make install

4. Installing openssl-1.0.1j

./config--prefix=/usr/local/openssl1j enable-shared # enable-shared Without this item, httpd compile will error. A little strange is that in the virtual machine will be error, hint to add #-fpic what, notes in the home computer, also can't remember. Make $$ make install

Export the library file and create a new/etc/ld.so.conf.d/openssl1j.conf file. HTTPS will use the new version of the library file.

Vim/etc/ld.so.conf.d/openssl1j.confldconfig

The file content is written in the path of the Lib under your OpenSSL installation directory. Such as:

/usr/local/openssl1j/lib


5. Installing httpd2.4.10

./configure--prefix=/usr/local/httpd2.4--sysconfdir=/etc/httpd2.4--enable-so--enable-ssl--enable-rewrite-- enable-cgi--with-zlib--with-pcre--with-apr=/usr/local/apr1.5/--with-apr-util=/usr/local/apr1.5/--with-ssl=/usr /local/openssl1j/--enable-modules=most--enable-mpms-shared=all--with-mpm=eventmake && make install#-- Prefix installation directory--sysconfdir profile directory--enable-so turn on DSO dynamic loading shared module--enable-ssl HTTPS function--enable-rewrite address rewriting--en able-cgi CGI scripting function--with-zlib compression function library--with-pcre Perl Library The directory of the software just installed--enable-modules=most compiling common modules--enable-mpms-s Hared=all all dynamic modules behind this default Mount MPM module event.

6. Miscellaneous

(1) Go to httpd's installation directory to see the results. All OK words can be the following.

(2) The httpd of the head file symbol link to the/usr/include #不是必须的, afraid that the software will be used later.

Ln-s/usr/local/httpd2.4/include//usr/include/httpd2.4

(3) Create a new/etc/profile.d/httpd2.4.sh file and add the path variable.

Vim/etc/profile.d/httpd2.4.sh #写入文件内容, executes a sourcesource/etc/profile.d/httpd2.4.sh file content: Export path=/usr/local/h Ttpd2.4/bin: $PATH

Note that the path is written at the head of path so that bash finds the new httpd first. Otherwise the auto-Open will be the former httpd.

[Email protected] bin]# echo $PATH/usr/local/httpd2.4/bin:/usr/local/httpd2.4/bin:/usr/lib64/qt-3.3/bin:/usr/ Local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

(4) Stop your old httpd to see if the new one is going to work.

[Email protected] openssl1j]# HttpdAH00557:httpd:apr_sockaddr_info_get () failed for centos-officeah00558:httpd: Could not reliably determine the server ' s fully qualified domain name, using 127.0.0.1.  Set the ' ServerName ' directive globally to suppress this message[[email protected] openssl1j]# httpd-v #查看版本Server version:apache/2.4.10 (Unix) Server Built:nov 11:10:33[[email protected] openssl1j]#

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4E/26/wKiom1RgPerQ9KC_AADJ-1qL3Xg600.jpg "title=" Screenshot.png "alt=" Wkiom1rgperq9kc_aadj-1ql3xg600.jpg "/>

It seems that I can run here for the time being. Start httpd when the error, as long as the host name can be resolved from their own IP, it is OK. Well, in our case, just doing experiments, doing exercises. Adding to the/etc/hosts file is a good idea.

Like me here, add a line:

172.16.2.0 Centos-office
It's OK.

(5) A service script can be used to start the shutdown.

In order to avoid trouble, directly to the original HTTPD service script copy, change it.

Cp/etc/init.d/httpd/etc/init.d/httpdvim/etc/init.d/httpd

First paste the parts to be changed, occupy the layout.

 40  41 # path to the apachectl script, server binary,  and short-form for messages. 42 apachectl=/usr/sbin/apachectl              #这一行要改, I'll write down the bottom.     apachectl=/usr/local/httpd2.4/bin/apachectl       #注意路径, Look where you installed it.         43 httpd=${HTTPD-/usr/sbin/httpd}              #这一行也要改     httpd=/usr/local/httpd2.4/bin/ httpd        #因为httpd2.4 The MPM module can be loaded dynamically.                                   #所以就不用运行不同MPM模块的程序, it's OK to designate this one.                                 #  44 prog=httpd 45 pidfile=${PIDFILE-/var/run/httpd/httpd.pid}    #这一行改      pidfile=/var/run/httpd2.4/httpd2.4.pid        # Not the default path, but also httpd the configuration file,                                 # You can change the path to the logs directory under your installation directory, which is here by default.                                   46 lockfile=${ lockfile-/var/lock/subsys/httpd}    #这一行改     lockfile=/var/lock/subsys/ httpd2.4            #      47&nbSp retval=0 48 stop_timeout=${stop_timeout-10} 49

OK to save the exit.

The path to the PID file on the top is not the following line if you use the default path.

[Email protected] run]# mkdir httpd2.4[[email protected] run]# chmod the httpd2.4/#这个文件是由第一个httpd进程创建的 #这个进程是root启动的. Root permissions. [[email protected] httpd2.4]# vim/etc/httpd2.4/httpd.conf file Add this line: Pidfile "/var/run/httpd2.4/httpd2.4.pid"

Well, if there's a httpd process running now, Killall httpd

Then you can start to try it.

[[Email protected]tos-office run]# Service httpd start is starting httpd: [OK]

So for the time being the installation is complete.

Note: The httpd2.4 script is httpd, and the original httpd2.2 became Httpd.bak.

The name of our script is still httpd. Before httpd2.2 the time to add chkconfig words, you do not have to set up.

Chkconfig settings:

[[email protected] run]# chkconfig--list httpdhttpd Service supports Chkconfig, but it is not referenced at any level (run "Chkconfig--add httpd") [[Email  Protected] run]# chkconfig--add httpd[[email protected] run]# chkconfig httpd on[[email protected] run]# chkconfig--list HTTPDHTTPD 0: Off 1: Off 2: Enable 3: Enable 4: Enable 5: Enable 6: off [[email protected] run]#

PostScript: So that you can, beginners, which heroes pass by the discovery of problems, you must come to a brick ah.

This article is from the "on Foot" blog, make sure to keep this source http://fanqie.blog.51cto.com/9382669/1574984

Apache httpd-2.4.10 Compile and install

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.