centos6.9 Source code compilation httpd2.4

Source: Internet
Author: User
Tags install openssl

Brief introduction:

apache http  server (for short Apache ) is the Apache Software Foundation An open source Web page Web server; Because CENTOS6 is installed by default httpd2.2 version, does not have the new features of httpd2.4, in order to use version 2.4 of version 6, so as to take advantage of httpd2.4 new features to better fulfill the needs of the job.


Preparation matters:

1. System Environment:

centos6.9

2, the required source code installation package:

apr-1.6.2.tar.gz apr-util-1.6.0.tar.gz httpd-2.4.27.tar.bz2

3. Create a directory dedicated to the APR apr-util httpd packet

Mkdir/app


Experimental steps:

0, Check the old version of the Apache package name, uninstall the old version of Apache, or directly find a clean 6.9 system to do experiments can also.

Rpm-q httpd

RPM-E httpd


1, install the development package Group "Development Tools"

Yum groupinstall "Development tools"


2. Download the source httpd2.4, ARP, ARP-UTIL installation package and unzip on the official website :

Official website: http://www.apache.org/index.html

cd/usr/local/src/#把安装包刚放在这目录下

Tar xvf apr-1.6.2.tar.gz

Tar apr-util-1.6.0.tar.gz

Tar httpd-2.4.27.tar.bz2


3. compile and install dependent apr-1.6

Under the/usr/local/src/path

CD apr-1.6.2

Cat README #查看一下编译文档

Execute Configure script

./configure--PREFIX=/APP/APR #指定apr的安装路径

Make & make install #开始安装


4. Compile and install apr-util-1.6

Cd apr-util-1.6.0 #进入apr-util directory

./configure--help # View the path to the installation package

./configure--prefix=/app/apr-util--with-apr=/app/apr #--with-apr=/app/apr the specified path

Make & make Install #开始安装

Note: If error error:expected errors occur, you need to install Expat-devel package

Yum Install openssl-devel pcre-devel expat-devel


5. Create an Apache account

Useradd-r-d/app/website-s/sbin/nologin apache-m

#-d/app/website specify the path to the site home page, mandatory creation of /app/website plus-M


6. Compile and install httpd-2.4

CD 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


Detailed compilation parameters:

--prefix=/app/httpd24 : Specify the path to the installation directory

--ENABLE-SO: Support dynamic sharing module, if not this module PHP will not work with Apache combined

--ENABLE-SSL: Support SSL, HTTPS enabled

--ENABLE-CGI: Starting a CGI interface with an external application

--enable-rewrite: Support URL rewriting

--with-zlib: Support Web page compression transfer

--with-pcre: Supported extended Regular expressions

--with-apr=/app/apr/: Specify Apr path

--with-apr-util=/app/apr-util/: Specify apr-util path

--enable-modules=most: Install most modules

--enable-mpms-shared=all: Support for most shared modules

--with-mpm=prefork: prefork default mode for installing MPM operating mode


Execute the following command after compilation is complete

Make & make Install

If there is an error, what package is missing, and then execute the above installation command

Yum Install Openssl-devel Pcre-devel


7, modify the main configuration file to change the default user comments to allow Apach users to access

Master configuration file:/app/httpd24/conf/httpd.conf

Vim/app/httpd24/conf/httpd.conf

User Apache #添加Apache users

Group Apache #添加Apache

Documentroot/app/website #把默认的主站点改成/app/website

<directory/app/website> #修改权限

Require all granted #允许所有


8, in order to facilitate the use of the command need to add the path of environment variables, edit the binary program to let the system can find

vim/etc/profile.d/httpd24.sh

Path=/app/httpd24/bin: $PATH


9, set the boot-up script,

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}

Set Boot Startup items

Chkconfig--add httpd24 #添加到运行服务脚本里

Chkconfig httpd24 on #设置开机启动

Service HTTPD24 Start


10. Generate test Page

Create a primary Site page and edit the contents of the main page directly if you have already created it

Mkdir/app/website

Echo/app/website > index.html


11. Start httpd

Apachectl start

Ss-ntl #查看监听接口发现80端口打开, the experiment proved successful.

12, the browser visits the page, appears the /app/website content to explain the experiment successfully.


Precautions:

1,httpd2.4 need to rely on APR and Arp-util package must be more than 1.4 version

2, during the compilation and installation of Apr or httpd in the process of error can install the following package to solve

Yum Install Openssl-devel pcre-devel expat-devel

3, httpd 2.4 on the centos6.9 depends on the APR package CD comes with a relatively low version, so you need to install a higher version, on the CENTOS7 version of the package with a dependent version of the high, meet the requirements, directly installed HTTPD 2.4 can be used.

This article is from the "12180356" blog, please be sure to keep this source http://12190356.blog.51cto.com/12180356/1971002

centos6.9 Source code compilation httpd2.4

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.