apache2.2.31 Source Installation Detailed process

Source: Internet
Author: User

apache2.2.31 Source Installation detailed process

This article is to install Apache in the virtual machine in the detailed process, the need for friends can refer to;


First of all, we take a first step:

    1. Install the compilation environment

    2. Uninstall Legacy Apache

    3. Download the source Package

    4. Installing Apache

    5. Modifying a configuration file

    6. Test Apache

    7. View Apache Build Directory

    8. adding Apache to system services and booting from boot

First, install the compilation environment

Before installing Apache, we need to install the relevant software packages needed to compile Apache;


Yum-y install gcc gcc++ zlib zlib-devel


Second, uninstall the original Apache


Rpm-qa |grep httpd

RPM-E--nodeps httpd-2.2.15-29.el6.centos.x86_64

RPM-E--nodeps httpd-tools-2.2.15-29.el6.centos.x86_64


Third, download the decompression source package

wget http://apache.fayea.com/httpd/httpd-2.2.31.tar.gz


Then TAR-ZXVF httpd-2.2.31.tar.gz && cd httpd-2.2.31/


iv. installation of Apache

./configure--prefix=/usr/local/apache2--enable-rewrite--enable-so--enable-headers--enable-expires--with-mpm=wo Rker--enable-modules=most--enable-deflate

--PREFIX=/USR/LOCAL/APACHE2 indicates the installation path for the specified Apache, the default installation path is/usr/local/apache2

--enable-rewrite provides a more tender rewrite of the URL rules, which translates to other desired URL addresses based on a known URL address

--ENABLE-SO activation of the Apache service DSO (dynamic shared objects dynamically sharing target), that is, in the future can be in the DSO

Compile and install the shared module, the module itself cannot be compiled with DSO.

The--enable-headers provides control of the HTTP request header that is allowed.

--enable-expires Activation Xunyu Controls HTTP's "Expires:" and "Cache-control:" header content through the configuration file, which is the

Web site pictures, JS, CSS and other content, provide client browser cache settings. This is one of the important options for Apache tuning.

--with-mpm=worker Select the Apache MPM mode for worker mode. The principle for worker mode is that more threads are used to process the

So that more concurrent requests can be processed. While the overhead of system resources is little jade based on the process of MPM prefork. If you do not specify this parameter

Number, the default mode is Prefork process mode. This is one of the important options for Apache tuning.

--enable-deflate provides compression transmission encoding support for content, usually HTML, JS, CSS and other content of the site. Using this parameter will increase the transfer speed and enhance the visitor's experience. In a production environment, this is one of the important options for Apache tuning.


Make && make install


After installing Apache, view the installed directory as follows

Cd/usr/local/apache2 && LL

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/74/AF/wKiom1YmAmyT3m1gAAFU2Jo4ecs800.jpg "title=" QQ picture 20151020165449.png "alt=" Wkiom1ymamyt3m1gaafu2jo4ecs800.jpg "/>

V. Modify the configuration file

Vim/usr/local/apache2/conf/httpd.conf

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/74/AF/wKiom1YmBAHhoShoAAAnAa1tEXc515.jpg "title=" QQ picture 20151020170320.png "alt=" Wkiom1ymbahhoshoaaanaa1texc515.jpg "/>

Remove the # number and you can.


VI. Test Apache


Copy the Apache startup script to the/ETC/RC.D/INIT.D directory, as follows:

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


In fact, Apache boot is called/usr/local/apache2/bin/httpd this command, view the contents of the script, as follows:

Cat/etc/init.d/httpd|grep-v ^#|grep-v ^$

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/74/B0/wKiom1YmBRzTjcNCAAFuBIhW_5A102.jpg "title=" QQ picture 20151020170812.png "alt=" Wkiom1ymbrztjcncaafubihw_5a102.jpg "/>

The bottom part.


Launch Apache, as follows


/ETC/INIT.D/HTTPD start


NETSTAT-LNTP | grep 80


Lsof-i: 80


You can also use/USR/LOCAL/APACHE2/BIN/HTTPD to start. As follows:

/usr/local/apache2/bin/httpd–k start


After Apache boot is complete, let's take a look at the following commands:

wget 127.0.0.1

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/74/B0/wKiom1YmBmeDC9yIAADy3dzLMt0724.jpg "title=" QQ picture 20151020171340.png "alt=" Wkiom1ymbmedc9yiaady3dzlmt0724.jpg "/>


Firefox 127.0.0.1


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/74/B0/wKiom1YmBq6QfMLrAACOpembA-Q223.jpg "title=" QQ picture 20151020171450.png "alt=" Wkiom1ymbq6qfmlraacopemba-q223.jpg "/>


Through, we can see Apache installed successfully!


Vii. viewing the directory generated by Apache installation


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/74/AC/wKioL1YmCKuDcHYEAAFU2Jo4ecs246.jpg "title=" QQ picture 20151020165449.png "alt=" Wkiol1ymckudchyeaafu2jo4ecs246.jpg "/>



Bin Main Store program command directory,.

Conf primarily stores Apache configuration files.

Htdocs primarily stores the site directory.

The logs primarily stores the default log files.

Modules primarily stores Apache's operating modules. For example, PHP, memcache compiled modules are stored here.


VIII. viewing the Apache configuration file


View the httpd.conf configuration content as follows:

Egrep-v ' ^[]*#|^$ '/usr/local/apache2/conf/httpd.conf | nl650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/74/B0/wKiom1YmCdfR6lbqAAG8Uz0EO5k123.jpg "title=" QQ picture 20151020172826.png "alt=" wkiom1ymcdfr6lbqaag8uz0eo5k123.jpg "/>650) this.width=650;" src= "/HTTP/ S3.51cto.com/wyfs02/m00/74/ac/wkiol1ymcjajrljmaahyonbxrji107.jpg "title=" qq picture 20151020172919.png "alt=" Wkiol1ymcjajrljmaahyonbxrji107.jpg "/>650) this.width=650;" Src= "http://s3.51cto.com/wyfs02/M02/74/B0/ Wkiom1ymckjywsvhaafodw1m0vq375.jpg "title=" qq picture 20151020173016.png "alt=" Wkiom1ymckjywsvhaafodw1m0vq375.jpg "/>

ServerRoot "/usr/local/apache2" represents the Apache root directory, which should be accessed only by the root user and generally does not need to be modified.

Listen 80 represents the Apache listening port, which defaults to 80. If you are monitoring port 81 at the same time, add one line: Listen 81.

AddType application/x-httpd-php. php LoadModule php5_module modules/libphp5.so is used when Apache integrates with PHP.

User Daemon Group Daemon represents the Apache runtime users and groups, the default is daemon, recommended modifications, such as Apache.

DocumentRoot "/usr/local/apache2/htdocs" means Apache Default Web site Directory, do not add a slash at the end of the path.

ServerAdmin [Email protected] represents the system administrator's mailbox, which is not an important option. When there is a problem with the site, the page address is displayed.

DirectoryIndex index.php index.html Configure the default Apache home page. If the virtual host is not configured, the configuration is applied here by default.

Errorlog "Logs/error_log" error log path.

LogLevel warn error log level.

scriptalias/cgi-bin/"/usr/local/apache2/cgi-bin/" to configure CGI aliases.

Ninth, Apache join system service



In order for Apache to boot, we can add the Apachectl boot script to the rc.local file, as follows:

echo "/usr/local/apache2/bin/apachectl start" >>/etc/rc.local


We can also launch Apache by adding Apache to the system service. There are two ways to add Apache as a system service, the first is to add it through Chkconfig, and the second is to add the system's individual boot levels directly.

Let us first introduce the first method, modify the startup httpd script to add the following two lines of command, as follows:

#chkconfig: 2345 70 60

#description: Apache

Description

chkconfig:2345 70 60 in 2345 refers to the running level of the script, that is, in 2345 of the 4 modes can be run, 234 is the text interface, 5 is the graphical interface x.

70 refers to the future startup sequence number of the script, if the start sequence number of other programs is smaller than 70 (such as 44, 45), the script needs to wait until these programs are started before starting. 60 refers to the stop order number of the script when the system shuts down.

Description:apache A short description of the script.


Use Chkconfig to add the following:

Chkconfig--add httpd

Chkconfig |grep httpd

To turn on Apache boot, use the following command:

Chkconfig httpd on

Chkconfig |grep httpd

After the above operation, Apache can boot up.

This article is from the "technology, never Stop" blog, please be sure to keep this source http://loyal.blog.51cto.com/10225521/1704627

apache2.2.31 Source Installation Detailed process

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.