Compile and install httpd-2.4.28 in CENTOS6

Source: Internet
Author: User
Tags install openssl

Method One,

1, install the development Environment Package group and related packages:

Yum Groupinstall "Development Tools"

Yum Install Pcre-devel openssl-devel expat-devel

2. Download the source code and unzip it:

RZ Import Source Code

Tar xvf httpd-2.4.28.tar.bz2 Decompression

Tar xvf apr-1.6.2.tar.bz2

Tar xvf apr-util-1.6.0.tar.bz2

3, Installation apr-1.6.2

①CD apr-1.6.2

②./configure--PREFIX=/APP/APR specifying the configuration file path

③make && make Install

4, Installation apr-util-1.6.0

①CD ~/apr-util-1.6.0

②./configure--prefix=/app/apr-util--with-apr=/app/apr/compiling apr-util requires calling Apr

③make && make install

5. Compile and install httpd-2.4.28

①CD ~/httpd-2.4.28

②./configure--prefix=/app/httpd24 \ enable some specific function modules

--ENABLE-SO \

--ENABLE-SSL \

--ENABLE-CGI \

--enable-rewrite \

--with-zlib \

--with-pcre \

--with-apr=/app/apr/\

--with-apr-util=/app/apr-util/\

--enable-modules=most \

--enable-mpms-shared=all \

--with-mpm=prefork

③make-j 4 && make install -j 4 means simultaneous compilation with four processors

Test: Cd/app/httpd24/bin

Apachectl Start Service

Ss-ntl viewing port 80 is open

650) this.width=650; "src=" Https://s2.51cto.com/oss/201710/20/a2d51b1a2263c2a980734a3dc6e0c36c.jpg "title=" Picture 1.jpg "alt=" A2d51b1a2263c2a980734a3dc6e0c36c.jpg "/>

6. for ease of use, you can Configuration PATH variables and service scripts

① Add the PATH variable:

vim/etc/profile.d/path.sh

Path=/app/httpd24/bin: $PATH

The execution script takes effect. /etc/profile.d/path.sh

②vim/app/httpd24/conf/httpd.conf modifies the following two lines to run the HTTPD service as Apache

User Apache

Group Apache

③ Configuration Service Script:

Cp/etc/init.d/httpd/etc/init.d/httpd24

VIM/ETC/INIT.D/HTTPD24 Modify the following four lines

Apachectl=/app/httpd24/bin/apachectl

HTTPD=${HTTPD-/APP/HTTPD24/BIN/HTTPD}

Pidfile=${pidfile-/app/httpd24/logs/httpd.pid}

LOCKFILE=${LOCKFILE-/VAR/LOCK/SUBSYS/HTTPD24}

④chkconfig--add httpd24 Add service Script

⑤service httpd24 Restart Restart Service

650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/20/b562f415719afe1d3d34372b07a7f01c.jpg "title=" Picture 2.jpg "style=" Float:none; "alt=" b562f415719afe1d3d34372b07a7f01c.jpg "/>

7. Test:

650) this.width=650; "src=" Https://s2.51cto.com/oss/201710/20/56e346be6465f3a8a20f9fe43d0ab95f.jpg "title=" Picture 3.jpg "alt=" 56e346be6465f3a8a20f9fe43d0ab95f.jpg "/>


Method Two,

Roughly the same as method one, but not the same when compiling

1, install the development Environment Package group and related packages:

Yum Groupinstall "Development tools"

Yum Install Openssl-devel pcre-devel expat-devel

2. Download the source code and unzip it:

RZ Import Source Code

Tar xvf apr-1.6.2.tar.gz

Tar xvf apr-util-1.6.0.tar.gz

Tar xvf httpd-2.4.28.tar.bz2


3. Place Apr and Apr-util under httpd-2.4.28/srclib/and rename

Cp-a apr-1.6.2 HTTPD-2.4.28/SRCLIB/APR

Cp-a apr-util-1.6.0 Httpd-2.4.28/srclib/apr-util


4. Compile and install

CD httpd-2.4.28

./configure--prefix=/app/httpd24 \

--ENABLE-SO \

--ENABLE-SSL \

--ENABLE-CGI \

--enable-rewrite \

--with-zlib \

--with-pcre \

--WITH-INCLUDED-APR \

--enable-modules=most \

--enable-mpms-shared=all \

--with-mpm=prefork

Make-j 4 && make install

5, modify the path variable is the service script, easy to use

vim/etc/profile.d/httpd24.sh

Path=/app/httpd24/bin: $PATH

Run the script to take effect. /etc/profile.d/httpd24.sh

6, modify the master configuration file, run HTTPD service as Apache identity

Vim/app/httpd24/conf/httpd.conf

User Apache

Group Apache

7. Configure Service Scripts

Cp/etc/init.d/httpd/etc/init.d/httpd24

Vim/etc/init.d/httpd24

Apachectl=/app/httpd24/bin/apachectl

HTTPD=${HTTPD-/APP/HTTPD24/BIN/HTTPD}

Pidfile=${pidfile-/app/httpd24/logs/httpd.pid}

LOCKFILE=${LOCKFILE-/VAR/LOCK/SUBSYS/HTTPD24}

Chkconfig--add httpd24

Service HTTPD24 Start Services


8. Test:

650) this.width=650; "src=" Https://s2.51cto.com/oss/201710/20/56e346be6465f3a8a20f9fe43d0ab95f.jpg "title=" Picture 3.jpg "alt=" 56e346be6465f3a8a20f9fe43d0ab95f.jpg "/>


Thanks for browsing, if in doubt, please leave a message

650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0080.gif "alt=" J_0080.gif "/>

Compile and install httpd-2.4.28 in CENTOS6

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.