Compile and install Apache

Source: Internet
Author: User

Tag: Compile and install Apache

Experiment Preparation
  1. Lab environment: Red Hat Enterprise 6.5
  2. Packages: Apr, Apr-util, httpd
    • Remarks: Apache official website Download http://www.apache.org/Download the required packages for the experiment and unzip to the specified folder to start the experiment

      First copy the extracted Apr and Apr-util to the designated folder.

      cp -R  cp -R apr /opt/httpd-2.4.2/srclib/aprcp -R  apr-util /opt/httpd-2.4.2/srclib/apr-util


      Install the build environment (using the Yum repository installation, you need to build a yum warehouse in advance, how to create a yum warehouse in my previous article)

      yum install gcc gcc-c++ make pcre pcre-devel -y
      Compile and install Apache

      Pre-installation configuration first

      ./configure --prefix=/usr/local/apache \         //安装路径--enable-so \                              //使用动态模块加载--enable-rewrite \                       //重写--enable-mods-shared=most \    //启用模块--with-mpm=worker \                  //使用多处理模块--disable-cgid \                          //开启通用网关接口--disable-cgi


      Installation

      make           //编译(转换成二进制语言)make install   //编译安装
      Service optimization

      For ease of administration, we want to add the HTTPD service to the system startup item
      We filter the script file with a single command and then add it to the/etc/init.d folder. The script file is not complete yet, and we need to make additional modifications to it.

      grep -v "#" /usr/local/apache/bin/apachectl > /etc/init.d/httpd

      Use the Vim editor to modify the file and insert the following in the first line

      #!/bin/sh# chkconfig:2345 85 15# description:Apache is a World Wide Web server


      Now this file does not have execute permission, we need to take the right action

      chmod +x /etc/init.d/httpd

      Add httpd Service

      chkconfig --add httpd

      Set the port to self-start in the character interface and graphical interface

      chkconfig --level 35 httpd on

      View service port Information

      chkconfig --list httpd

      To facilitate our management of Apache, we can create a soft connection to the/etc directory for the httpd.conf file

      ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf

      Editing a configuration file httpd.conf


      Open service

      service httpd start

      See if the service is open successfully

      netstat -ntap | grep 80
      Implementing host Access

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.