RET hat 6&ret hat 7 Apache website build (i)

Source: Internet
Author: User

about Apache

Apache HTTP Server is an outstanding representative of open source software projects based on standard The HTTP Network protocol provides a view of the net tribute

Service in We maintain more than half of the market share over the long term. aapache Server can run on lnux.unx

Wndows and many other operating system platforms,

The origin of the 1.Apache

The apathe server is a consolidation of several previously occurring Web server programs. Perfect after the formation of the software. Its name

called from A palchy Server means "based on the original Web Service Program code to modify ( T) after the formation of

Server program ",

1995 Year apeche service Program has been released since the release of "Apachegroup responsible for the management of the project

and maintenance, until 1999 years on the basis of Apachegroup established the Apache Software Foundation (Apache Sotwae

Foundation ASF). Currently, The Apache project has been managed and maintained by ASF,

ASF is a non-profit organization, initially responsible only for "Apacheweb Server Project management, as Web applications need to

the growing demand, ASF has gradually increased many open source software projects related to WEB technology so apsthe is not only now

represents the Web server, more broadly representing the many open source software projects that ASF manages,the official website of the ASF Foundation is

htip:/www apache org/.

Apachehttpserver is one of the famous software projects of ASF, whose official name is htpa"is the history

on the Apache Web server. In the later part of the book. If no special instructions are given, use "Apache or"http:d

all refer to, Apache HTP Server

Key features of 2.Apache

Apache server performance and security aspects of performance are more prominent can be better to meet the Web

The application requirements of server users, the main features include the following aspects.

Open Source code this is one of the important features of the Apache server is also the basis for other features. Apache Service Path

is maintained by many developers around the world and can be used freely by anyone, which fully embodies the open source software

Pieces of the spirit.


Cross-platform application This feature benefits from Apache Source code is open. Apache Server can run on most

The hardware and software platform, all UNX operating system can run Apache server and even Apache Service Manager can

to run well in most the Wndows system platform. The cross-platform nature of the Apache server enables beauty to be

Wide range of application conditions.


support a variety of Web programming language the Apache server can support Web programming languages including Perl,PHP,pythoon,Java

and so on, even Microsoft's ASP technology can also be used in Apache server to support a variety of commonly used Web

Process Language enables Apache has a wider range of application areas.


Modular Design Apache does not centralize all of its functions within a single service program, but implements proprietary functionality through standard modules as much as possible. This gives Apache servers the ability to write standard module programs to add Apache other features that are not in themselves.


very stable operation, Apache servers can be used to build WEB sites with heavy load traffic , and many well-known

industry sites are used Apache as a Web services software.


good security, Apache servers have relatively good security, which is a common feature of open source software.

and Apache 's maintenance team will be in time to provide patching of discovered vulnerabilities in order, for all Apache users

Provide as secure a server program as possible.

Service build Environment: RET hat 6, httpd-2.2.17,apr-1.4.6.tar.gz,apr-util-1.4.1.tar.gz

    1. Preparatory work

Avoid port conflicts, program conflicts and other phenomena, need to do the following check

[Email protected] ~]# NETSTAT-ANPT | grep 80

[Email protected] ~]# rpm-e httpd--nodeps

2. Install the build package using the Yum tool

Yum-y install gcc gcc-c++ make Pcre-devel

3. Unpack the Package

[Email protected] ~]# TAR-ZXF apr-util-1.4.1.tar.gz-c/opt

[Email protected] ~]# TAR-ZXF apr-1.4.6.tar.gz-c/opt

[Email protected] ~]# TAR-ZXF httpd-2.4.25.tar.gz-c/opt

4. Copy the optimization package to the HTTPD directory

[Email protected] opt]# cp-r APR-1.4.6/HTTPD-2.4.25/SRCLIB/APR

[Email protected] opt]# cp-r apr-util-1.4.1/httpd-2.4.25/srclib/apr-util

5. Enter the httpd directory to detect the target characteristics of the installation platform

[Email protected] opt]# CD httpd-2.4.25/

./configure \

--prefix=/usr/local/apache \

--ENABLE-SO \

--enable-rewrite \

--enable-mods-shared=most \

--with-mpm=worker \

--disable-cgid \

--disable-cgi

Parameter explanation:

--prefix=//To specify the installation path


--ENABLE-SO//This parameter indicates support for the functionality provided with the MOD_SO module, which dynamically loads a module with LoadModule in a httpd.conf file or included conf file. Enable Apache to support DSO mode


--enable-rewrite//Support URL rewriting


--enable-mods-shared=most///Option: tells 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 is configured in what mode 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

6. Compiling and installing the compilation

[[email protected] httpd-2.4.25]# make && make install

7. Confirm the installation results

[Email protected] httpd-2.4.25]# ls/usr/local/apache/

Bin Cgi-bin error icons lib man modules

Build conf htdocs include logs manual

8. Optimizing the Path

[Email protected] httpd-2.4.25]# ln-s/usr/local/apache/bin/*/usr/local/bin

9. See if the optimization was successful

[Email protected] httpd-2.4.25]# ls-l/usr/local/bin/httpd/usr/local/bin/apachectl

lrwxrwxrwx. 1 root root 31 June 00:51/usr/local/bin/apachectl-/usr/local/apache/bin/apachectl

lrwxrwxrwx. 1 root root 27 June 00:51/usr/local/bin/httpd-/USR/LOCAL/APACHE/BIN/HTTPD

10. Add httpd to system service

[Email protected] httpd-2.4.25]# CP/USR/LOCAL/APACHE/BIN/APACHECTL/ETC/INIT.D/HTTPD

[Email protected] httpd-2.4.25]# chmod +x/etc/init.d/httpd

[Email protected] httpd-2.4.25]# VIM/ETC/INIT.D/HTTPD

1 #!/bin/sh

2 #chkconfig: 35 85 21

[Email protected] httpd-2.4.25]# chkconfig--add httpd

[Email protected] httpd-2.4.25]# chkconfig--list httpd

httpd 0: Off 1: Off 2: Off 3: Enable 4: Off 5: Enable 6: Off

11. Configuring the HTTPD configuration file

[Email protected] ~]# vim/usr/local/apache/conf/httpd.conf

The meanings of each global configuration item are as follows.
ServerRoot, set the root directory of the httpd server, which includes the subdirectories required to run the Web site and
File. The default root directory is/usr/local/httpd. Same as the httpd installation directory, in the HTTPA conf configuration text
If you specify a directory or file location without using an absolute path, the directory or file location is considered
The root directory of the service.
Listen; Set HTTPD server Supervisor's network port number, default is 80.
User: Sets the identity of users when running the httpd process, which defaults to daemon.
Group: Sets the identity of groups when running the httpd process, which defaults to demon.
ServerAdmin; Set the administrator E-mal address of the HTIPD server, which can be contacted by this e-mal address in time
The administrator of the Web site.
ServerName: Sets the full host name (hostname + domain name) of the Web site.
Documentoot: Sets the site root directory, which is the actual location of the Web document in the system, the configuration item comparison capacity
Easy and serverroot confused, need to pay extra attention.
DirectoryIndex: Set the default index page of the site (first page), you can set up a number of home files, separated by spaces,
The default home file is index.html.
Erorlog: Sets the path to the error log file, and the default path is Logs/eror_log.
LogLevel; Sets the level of logging, with the default level of WAM (warning).
Custorlog. Sets the path, log type, and default path of the access log file to Logs/access_og. Using the
The type is common (common format).
Pidfile. Set the file to hold the httpd process number (PD), the default save address is LOGS/HTTPA Pid.logs
The directory is located under the Apache server root directory.
Charsetdefault; Sets the default character set encoding used by Web pages in the site, such as utf-8.gb2312.
Include. Contains the contents of another configuration file, which enables the configuration of some special features to be placed in a separate
file, and then use the include configuration item to include it in the httpd conf file, which makes it easy to configure the function independently
Maintenance without affecting the master configuration file.
The above configuration items are the primary global configuration items in the HTTPO conf file. There are many other configuration items, not listed here,
If you need to use it, you can view the relevant Help manual documentation in the Apache server.

Note: You need to turn off the firewall or add the appropriate port number.

The following is a simple script I wrote directly into the Linux can be used (for reference, non-commercial)


This article is from the "13219718" blog, please be sure to keep this source http://13229718.blog.51cto.com/13219718/1957866

RET hat 6&ret hat 7 Apache website build (i)

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.