RedHat Linux 9 Web Server installation and configuration)

Source: Internet
Author: User
Tags server installation and configuration

1. Install the Apache server
When installing red hat linux 9.0, you will be prompted whether to install the Apache server. If you are not sure whether the installation is successful, enter the following command in the terminal command window:

[Root @ ahpeng root] rpm-Qa grep httpd

If the result is displayed as a httpd-2.0.40-21, it indicates the system
The Apache server has been installed.

If the Apache server is not selected when Red Hat Linux 9.0 is installed, you can click the "Main Menu> system Settings> add or delete application" menu in the graphic environment, in the "software package management" dialog box that appears, make sure that the "World Wide Web server" option is selected, and then click the "Update" button. Follow the on-screen prompts to insert the installation disc to start installation.

Alternatively, you can insert 1st installation discs, locate the httpd-2.0.40-21.i386.rpm installation package under/RedHat/rpms, and then run the following command in the terminal command window to start the installation process:

[Root @ ahpeng RPMs] rpm-IVH httpd-2.0.40-21.i386.rpm

After installing the Apache server, you can run the following command in the terminal command window to start the apache service:

[Root @ ahpeng root]/etc/rc. d/init. d/httpd start

Restart the apache service:

[Root @ ahpeng root]/etc/rc. d/init. d/httpd restart

Disable the apache service:

[Root @ ahpeng root]/etc/rc. d/init. d/httpd stop

After you confirm that the apache service has been started, you can enter the following address in the web browser. If you can see the default Apache homepage, the Apache server works properly.

Htpp: // webserveraddress

The webserveraddress here refers to the IP address or domain name of the Web server. That is to say, webserveraddress should be replaced by the actual IP address or domain name of the Web server.

2. Configure the httpd. conf file
In earlier versions of Apache server, the configuration content is scattered in three files: httpd. conf, SRM. conf, and access. conf. The new version of Apache server is configured in httpd. conf. For the default Red Hat Linux installation, the configuration file is located in the/etc/httpd/confdirectory. If the configuration file is installed in the tar.gz version
The file is located in the/usr/local/Apache/conf directory.

With httpd. conf, we can perform global configuration for the Apache server, parameter definitions for the primary or preset server, and virtual host settings. Httpd. conf is a text file, which can be modified using vi, Kate, and other text editing tools. By analyzing the httpd. conf configuration file, we can easily find that:

This configuration file is divided into several sections, such as section 1: Global Environment (Section 1: Global Environment) and Section 2: 'main' server configuration (Section 2: master server configuration.

Each section has several configuration parameters in the form of "configuration parameter name specific value". Each configuration parameter has a detailed explanation in English (use # To guide each comment line ).

For your understanding, the most common configuration parameters of httpd. conf are provided here:

(1) DocumentRoot

This parameter specifies the path for the Apache server to store web pages. By default, all connections that require the provision of HTTP services use this directory as the main directory. The default values of Apache are as follows:

DocumentRoot "/var/www/html"

(2) maxclients

This parameter limits the maximum number of services that Apache can provide. That is, the number of connections at the same time cannot exceed this value. Once the number of connections reaches this limit, the Apache server will no longer provide services for other connections, to avoid a significant reduction in system performance. In this example, the maximum number of connections is 150:

Maxclients 150

(3) Port

This parameter is used to specify the listening port of the Apache server. Generally, the default port number of the standard HTTP service is 80. Do not change this value. In this example, port 80 is used:

Port 80

(4) servername

This parameter allows you to set the host name on your own to replace the real name of the host on which the Apache server is installed. This name must be a host name that has been registered on the DNS server. If the current host does not have a registered name, you can also specify an IP address. In this example, set the server name to


(5) maxkeepaliverequests

When the persistent connection function is used, you can use this parameter to determine the maximum number of requests that can be issued for each connection. If this value is 0, there is no limit. We recommend that you use a high value as much as possible to make full use of Apache's high performance. In this example, you can set the maximum number of requests per connection to 100:

Maxkeepaliverequests 100

(6) maxrequestsperchild

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, and to avoid overload of memory or other system resources.

It should be noted that the value of this parameter does not include the number of requests sent to maintain the connection. For example, if a sub-process is responsible for a request, the request then brings 10 requests required to maintain the connection function. For this parameter, the Apache server considers that this sub-process only processes one requirement, rather than 11.

The following settings can handle up to 10 requirements:

Maxrequestsperchild 10

(7) maxspareservers and minspareservers

The number of HTTP daemon that provide Web services varies with the number of connections. The Apache server dynamically adjusts the number of HTTP daemon to handle the current load. That is, it also maintains a certain amount of idle HTTP daemon to wait for new connection requests.

Apache regularly checks how many HTTP daemon are waiting for connection requests. If the idle HTTP daemon is more than the value specified by the maxspareservers parameter, Apache terminates some idle processes; if the idle HTTP daemon is less than the value specified by the minspareservers parameter, Apache generates a new HTTP daemon. In this example, the maximum number of idle daemon is set to 20, and the minimum number of idle daemon is set to 5:

Maxspareservers 20

Minspareservers 5

Of course, this is only some basic configuration items of Apache. You can flexibly modify them based on your actual situation to make full use of Apache's potential. If the configuration file does not take effect immediately after modification, restart the apache service.

Note: Make sure to back up data before modification!

3. graphical configuration interface

Graphical configuration is intuitive and simple, enough to cope with the daily management and maintenance of Apache servers. You can click "Main Menu> system Settings> Server Settings>
HTTP server menu, or directly enter the "apacheconf" command in the "Run Command" dialog box and press enter to access the "Apache configuration" dialog box. The configuration dialog box contains four tabs.

(1) "Main" tab

In the "server name" box, enter the server name, which is equivalent to the "servername" field in the httpd. conf file. You can enter the Administrator email address in the "Network Master email address" box, which is equivalent to the "serveradmin" field in the httpd. conf file. Click "add" (or "edit") in the "available addresses" Option Group to add or modify the Server IP address and port.

(2) "VM" tab

A virtual host service virtualizes a computer into multiple web servers. Using the "virtual host" service provided by the Apache server, we can use one computer to provide multiple Web Services.

You can use Apache to set up the VM service in two ways: IP address-based virtual host and name-based virtual host. There is a serious deficiency in the implementation of IP address-based virtual hosts. Each time a virtual host is added, an IP address must be added. This section describes how to create a name-based VM.

Assume that the IP address of an Apache server is and the host name is It also has two aliases: and Although the IP addresses of the three websites are the same, they all point to However, because a name-based virtual host is set up, it can point to different web pages.

When setting, click the "add" button on the "VM" tab and select the "name-based VM" option in the "host information" drop-down list box in the displayed configuration dialog box, enter an appropriate data IP address, host name, and so on. Remember to add an alias, as shown in figure 2.

The settings on the other two tabs in the "Apache configuration" dialog box are basically the same as the httpd. conf parameter configuration described earlier.


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: 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.