Linux Study Notes 14-set up an Apache HTTP Server

Source: Internet
Author: User
In the graphic environment, click the "applications → system settings → Add/Remove application" menu item,
Select the "Web server" option under the server, click the update button, and follow the prompts for installation.
1-2:
Figure 1:

Figure 2:

Before installation, You need to load the Linux installation CD.
3:
Figure 3:

After installing the Apache server, you can enter a command in the Command window to start the apache service:
[Root @ centos4 ~] #/Etc/rc. d/init. d/httpd start
Starting httpd: [OK]
[Root @ centos4 ~] #

After the HTTP service is started, perform a simple test on the HTTP service. 4:
Figure 4:

Disable the apache service:
[Root @ centos4 ~] #/Etc/rc. d/init. d/httpd stop
Stopping httpd: [OK]

Restart the apache service:
[Root @ centos4 ~] #/Etc/rc. d/init. d/httpd restart
Stopping httpd: [OK]
Starting httpd: [OK]

Next we will briefly understand how to configure the HTTP (APACHE) server:
The configuration file httpd. conf is located in the/etc/httpd/conf directory.

[Root @ centos4 ~] # Cat/etc/httpd/CONF/httpd. conf
#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file. It contains
# Configuration directives that give the server its instructions.
# See <URL: http://httpd.apache.org/docs-2.0/> for detailed information about
# The directives.
#
# Do not simply read the instructions in here without understanding
# What they do. They're here only as hints or reminders. If you are unsure
# Consult the online docs. You have been warned.
#
# The configuration directives are grouped into three basic sections:
#1. directives that control the operation of the Apache server process as
# Whole (the 'Global Environment ').
#2. directives that define the parameters of the 'main' or 'default' server,
# Which responds to requests that aren't handled by a virtual host.
# These directives also provide default values for the settings
# Of all virtual hosts.
#3. settings for virtual hosts, which allow Web requests to be sent
# Different IP addresses or hostnames and have them handled by
# Same Apache server process.

......

The configuration file is divided into three sections: a global environment and a 'main' or 'default' server.
The master service/default server configuration, and the other is the settings for virtual hosts virtual port configuration.

Common configuration parameters include:
DocumentRoot "/var/www/html" specifies the path for the Apache server to store web pages.

Graphic Interface Configuration display 5:
Figure 5:

Maxclients 118 this parameter limits the maximum number of services that Apache can provide. The maximum value can be set to 256.

Command line:
... Omitted
# Prefork mpm
# Startservers: Number of server processes to start
# Minspareservers: Minimum number of server processes which are kept spare
# Maxspareservers: Maximum number of server processes which are kept spare
# Maxclients: Maximum number of server processes allowed to start
# Maxrequestsperchild: Maximum number of requests a server process serves
<Ifmodule prefork. c>
Startservers 8
Minspareservers 5
Maxspareservers 20
Maxclients 118
Maxrequestsperchild 100
</Ifmodule>
... Omitted

Graphical interface configuration display 6:
Figure 6:

Port 80 specifies the listening port of the Apache server. The default port of the standard HTTP server is 80.

Command line:
... Omitted
# Listen: allows you to bind Apache to specific IP addresses and/or
# Ports, in addition to the default. See also the <virtualhost>
# Directive.
#
# Change this to listen on specific IP addresses as shown below
# Prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
# Listen 12.34.56.78: 80
Listen *: 80
... Omitted

Graphical interface configuration display 7:
Figure 7:

Servername centos sets the host name. You must register the host name on the DNS server to use this name for access. Otherwise, you must specify an IP address.
Command line:
... Omitted
# Servername gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# It explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# Redirections will not work. See also the UseCanonicalName directive.
#
# If your host doesn' t have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# Redirections work in a sensible way.
#
Servername centos

... Omitted

Maxkeepaliverequests 100 when using the persistent connection function,
You can use this parameter to determine the maximum number of requests that can be issued for each connection.

Maxrequestsperchild 10 this parameter limits the number of requests that can be processed by each child process before the end. Once this number is reached, the child process will be aborted, to avoid occupying Apache (or the function library used by the Apache server) for a long time ),
This prevents overload of memory or other system resources.

Maxspareservers and minspareservers provide HTTP daemon for Web Services.

When configuring Apache, we can select graphical interface configuration
You can also modify the httpd. conf parameter of the configuration file.

[End]

Related Article

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.