Manually compile and install Apache

Source: Internet
Author: User

Experimental Environment

RHEL6.5 version

IP Address: 192.168.1.63 255.255.255.0

Install the Yum warehouse and install GCC, gcc-c++? , make? , Pcre, Pcre-devel four packages (pcre: A Perl library that supports regular expressions) (System comes with)

The software package used in the experiment: http-2.4.2.tar.gz,apr-1.4.6.tar.gz,apr-util-1.4.1.tar.gz.

-------------------------------------------------------------procedure-------------------------------------------------------- ----------------------------

First, mount the folder under the good package to the Linux system.

MOUNT.CIFS//Host address/Package folder/opt/lamp

?

Two, unzip the above three bags under the/opt.
Tar xzvf http-2.4.2.tar.gz-c/opt/
Tar xzvf apr-1.4.6.tar.gz-c/opt/? (Support Apache Upper application cross-platform, provide the bottom interface library)
Tar xzvf apr-util-1.4.1.tar.gz-c/opt/

After extracting three packets sequentially, LS view/opt.

?

Four, put the unpacked package into the httpd folder.
Cp-r? Apr (unpacked folder)/OPT/HTTPD-2.4.2/SRCLIB/APR
Cp-r? Apr-util (unzipped folder)/opt/httpd-2.4.2/srclib/apr-util


Five, source code compiled to install Apache.
Enter under [[email protected] httpd-2.4.2]#

./configure \
--prefix=/usr/local/apache \
--ENABLE-SO \
--enable-rewrite \
--enable-mods-shared=most \
--with-mpm=worker \
--disable-cgid \
--disable-cgi

The above parameters are explained:

--prefix=?? To specify the installation path

--enable-so? This parameter indicates support for the functionality provided with the MOD_SO module and dynamically loading a module in a httpd.conf file or contained conf file with LoadModule. Enable Apache to support DSO mode

--enable-rewrite? Support for URL rewriting

--enable-mods-shared=most? Option: Tell the compiler to dynamically compile all the standard modules into the DSO module.

--with-mpm=worker//Let Apache run as worker

--with-mpm=worker?? This parameter configures the mode in which Apache will compile. The Apache Web site document indicates different default modes under different operating systems.

--disable-cgid//Prohibit execution of CGI scripts with an external CGI daemon

--DISABLE-CGI//Prohibit compiling CGI version of PHP

Then:

Make?? #编译
Make install??? #安装

?

Six, optimize the path and link all the command contents under/usr/local/apache/bin/to the path in the path variable.

commands can be used only if the command is linked to the path of the path variable.

Grep-v "#"/usr/local/apache/bin/apachectl >/ETC/INIT.D/HTTPD

Vi/etc/init.d/httpd?? # Insert the following line at the front of the file

#!/bin/sh
??? # chkconfig:2345 85 15
??? # Description:apache is a world Wide Web server.

Seven, so that programs can use service management.

chmod +x/etc/init.d/httpd? #添加写的权限给httpd
Chkconfig--add httpd?????? #开机自动加载
Chkconfig--list httpd
Chkconfig--level httpd on??? #打开3.5 mode

Eight, to establish a soft connection easy to manage
Ln-s/usr/local/apache/conf/httpd.conf/etc/httpd.conf (Note: A soft connection uses an absolute path)

[Email protected] httpd-2.4.2]# vim/etc/httpd.conf???? #编辑apache配置文件

Listen:ipv4, #去掉 #


ServerName: hostname. Domain name?????? (Write your Own)

?

Nine. Turn off the firewall and turn on the service.

Service Iptables Stop #关闭防火墙

Service httpd stop# Shutdown Services

Service httpd start# Start Services

[Email protected] httpd-2.4.2]# Netstat-ntap | Grep??? #监听http服务
Tcp??????? 0????? 0 192.168.78.130:80?????????? 0.0.0.0:*?????????????????? LISTEN????? 88630/HTTPD????????

?

Ten, the physical machine validates the HTTP service.

?

Success

?

Note: The index of the Apache service is stored under/usr/local/apache/htdocs/. HTML Web page, used to verify that the secondary service started successfully, in this directory, you can create more Web page files.

Manually compile and install Apache

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.