LANMP Series Tutorial Apache compilation installation CENTOS7 environment

Source: Internet
Author: User
Tags install openssl

1. Prepare the source package and configure the Yum source. , the required source package includes: httpd-2.4.18, apr-1.5.2.tar.gz, apr-util-1.5.4.tar.gz


2. Prepare the user

Groupadd-r Apache

Useradd-r apache-g apache-s/sbin/nologin


3. Prepare the environment, execute the following 4 commands, this step is not.

Install the following four package groups in turn:

Yum Groupinstall ' development tools '-y

Yum Install Openssl-devel-y

Yum Install Zlib-devel-y

Yum Install Pcre-devel-y

4. Compile and install Apr

TAR-XF apr-1.5.2.tar.gz && CD apr-1.5.2

./configure--PREFIX=/USR/LOCAL/APR

Make && make install


5. Compile and install Apr-util

TAR-XF apr-util-1.5.4.tar.gz && CD apr-util-1.5.4

./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/

Make && make install

6. Go to the Orthodox dish and start compiling and installing Apache

TAR-XF httpd-2.4.18.tar.gz && CD httpd-2.4.18

./configure--prefix=/usr/local/httpd \
--sysconfdir=/etc/httpd \
--enable-so \
--enable-rewrite \
--enable-ssl \
--enable-cgi \
--enable-cgid \
--enable-modules=all \
--enable-mods-shared=all \
--enable-mpms-shared=all \
--with-mpm=Event \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util

Make && make install

#注释: The above Event can be replaced by other processing modules, the specific meaning can be three types of MPM models for Baidu Apache


The way the compilation is done


7. The final processing work:

Echo ' Export path= $PATH:/usr/local/httpd/bin ' >>/etc/profile.d/httpd.sh

Echo ' pidfile '/var/run/httpd.pid ' >>/etc/httpd/httpd.conf

Vim/etc/httpd/httpd.conf


Change Apache's default running user to the Apache user we created

User Daemon

Group Daemon

Change into

User Apache

Group Apache


Configure startup scripts to enable service and Chkconfig

Cp/usr/local/httpd/bin/apachectl/etc/init.d/httpd

Vim/etc/init.d/httpd


Start the service:

Test:


To this, Apache compiles the installation successfully.

LANMP Series tutorial Apache compile and install CentOS7 environment

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.