Centos6.9 compile and install httpd2.4

Source: Internet
Author: User
Tags install openssl

Centos6.9 compile and install httpd2.4

Environment:
Centos6.9
Apr-1.6.2.tar.gz
Apr-util-1.6.0.tar.gz
Httpd-2.4.27.tar.bz2

1. Install the development package Group

[root@CentOS6 /app]$ yum groupinstall "Development tools"[root@CentOS6 /app]$ yum install openssl-devel pcre-devel expat-devel

Ii. Download and decompress the Software Package

[root@CentOS6 /app]$tar xvf apr-1.6.2.tar.gz    [root@CentOS6 /app]$tar xvf apr-util-1.6.0.tar.gz[root@CentOS6 /app]$tar xvf httpd-2.4.27.tar.bz2

Iii. Compilation and installation 1) apr

[root@CentOS6 /app]$cd apr-1.6.2[root@CentOS6 /apr-1.6.2]$./configure --prefix=/app/apr[root@CentOS6 /apr-1.6.2]$make -j 4 & make install

2) apr-util

[root@CentOS6 /app]$cd /app/apr-util-1.6.0 [root@CentOS6 /apr-util-1.6.0]$./configure --prefix=/app/apr-util --with-apr=/app/apr[root@CentOS6 /apr-util-1.6.0]$make -j 4 & make install

3) httpd2.4 ① create an account

[root@CentOS6 /app]$useradd -r -d  /app/website -s /sbin/nologin apache  

② Compile and install

[root@CentOS6 /app]$cd /app/httpd-2.4.27[root@CentOS6 /httpd-2.4.27]$./configure --prefix=/app/httpd24 --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[root@CentOS6 /httpd-2.4.27]$make -j 4 & make install

4. Configure 1) configure the httpd service

[root@CentOS6 /httpd-2.4.27]$vim /app/httpd24/conf/httpd.confuser apachegroup apacheDocumentroot /app/website<directory /app/website>

2) configure the PATH variable

[root@CentOS6 /httpd-2.4.27]$vim /etc/profile.d/httpd24.shexport PATH=/app/httpd24/bin:$PATH

3) configure the service script

[root@CentOS6 /httpd-2.4.27]$vim /etc/init.d/httpd24apachectl=/app/httpd24/bin/apachectlhttpd=${HTTPD-/app/httpd24/bin/httpd}pidfile=${PIDFILE-/app/httpd24/logs/httpd.pid}lockfile=${LOCKFILE-/var/lock/subsys/httpd24}

4) Add a service script and set startup.

[root@CentOS6 /app]$chkconfig --add httpd24[root@CentOS6 /app]$chkconfig  --list httpd24httpd24         0:off   1:off   2:off   3:off   4:off   5:off   6:off[root@CentOS6 /app]$chkconfig httpd24 on

5) create a home site folder and start the service

[root@CentOS6 /app]$mkdir /app/website[root@CentOS6 /app]$echo /app/website/index.html > /app/website/index.html[root@CentOS6 /app]$service httpd24 start[root@CentOS6 /app]$ss -tnl|grep 80LISTEN     0      128                      :::80                      :::*

V. Test

[root@CentOS6 /app]$curl 172.18.46.6This is a test web page

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.