A.3. Installing and Configuring the Apache HTTP Server

A.3. Installing and Configuring the Apache HTTP Server

The Apache HTTP Server must be installed and configured on all nodes in the assigned failover domain, if used, or in the cluster. The basic server configuration must be the same on all nodes on which it runs for the service to fail over correctly. The following example shows a basic Apache HTTP Server installation that includes no third-party modules or performance tuning.

On all node in the cluster (or nodes in the failover domain, if used), install the httpd RPM package. For example:

rpm -Uvh httpd-<version>.<arch>.rpm

To configure the Apache HTTP Server as a cluster service, perform the following tasks:

  1. Edit the /etc/httpd/conf/httpd.conf configuration file and customize the file according to your configuration. For example:

    • Specify the directory that contains the HTML files. Also specify this mount point when adding the service to the cluster configuration. It is only required to change this field if the mount point for the web site's content differs from the default setting of /var/www/html/. For example:

      DocumentRoot "/mnt/httpdservice/html"
      
    • Specify a unique IP address to which the service will listen for requests. For example:

      Listen 192.168.1.100:80
      

      This IP address then must be configured as a cluster resource for the service using the Cluster Configuration Tool.

    • If the script directory resides in a non-standard location, specify the directory that contains the CGI programs. For example:

      ScriptAlias /cgi-bin/ "/mnt/httpdservice/cgi-bin/"
      
    • Specify the path that was used in the previous step, and set the access permissions to default to that directory. For example:

      <Directory /mnt/httpdservice/cgi-bin">
      AllowOverride None
      Options None 
      Order allow,deny 
      Allow from all 
      </Directory>
      

      Additional changes may need to be made to tune the Apache HTTP Server or add module functionality. For information on setting up other options, refer to the Red Hat Enterprise Linux System Administration Guide and the Red Hat Enterprise Linux Reference Guide.

  2. The standard Apache HTTP Server start script, /etc/rc.d/init.d/httpd is also used within the cluster framework to start and stop the Apache HTTP Server on the active cluster node. Accordingly, when configuring the service, specify this script by adding it as a Script resource in the Cluster Configuration Tool.

  3. Copy the configuration file over to the other nodes of the cluster (or nodes of the failover domain, if configured).

Before the service is added to the cluster configuration, ensure that the Apache HTTP Server directories are not mounted. Then, on one node, invoke the Cluster Configuration Tool to add the service, as follows. This example assumes a failover domain named httpd-domain was created for this service.

  1. Add the init script for the Apache HTTP Server service.

    • Select the Resources tab and click Create a Resource. The Resources Configuration properties dialog box is displayed.

    • Select Script form the drop down menu.

    • Enter a Name to be associated with the Apache HTTP Server service.

    • Specify the path to the Apache HTTP Server init script (for example, /etc/rc.d/init.d/httpd) in the File (with path) field.

    • Click OK.

  2. Add a device for the Apache HTTP Server content files and/or custom scripts.

    • Click Create a Resource.

    • In the Resource Configuration dialog, select File System from the drop-down menu.

    • Enter the Name for the resource (for example, httpd-content.

    • Choose ext3 from the File System Type drop-down menu.

    • Enter the mount point in the Mount Point field (for example, /var/www/html/).

    • Enter the device special file name in the Device field (for example, /dev/sda3).

  3. Add an IP address for the Apache HTTP Server service.

    • Click Create a Resource.

    • Choose IP Address from the drop-down menu.

    • Enter the IP Address to be associated with the Apache HTTP Server service.

    • Make sure that the Monitor Link checkbox is left checked.

    • Click OK.

  4. Click the Services property.

  5. Create the Apache HTTP Server service.

    • Click Create a Service. Type a Name for the service in the Add a Service dialog.

    • In the Service Management dialog, select a Failover Domain from the drop-down menu or leave it as None.

    • Click the Add a Shared Resource to this service button. From the available list, choose each resource that you created in the previous steps. Repeat this step until all resources have been added.

    • Click OK.

  6. Choose File => Save to save your changes.


Note: This documentation is provided {and copyrighted} by Red Hat®, Inc. and is released via the Open Publication License. The copyright holder has added the further requirement that Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. The CentOS project redistributes these original works (in their unmodified form) as a reference for CentOS-5 because CentOS-5 is built from publicly available, open source SRPMS. The documentation is unmodified to be compliant with upstream distribution policy. Neither CentOS-5 nor the CentOS Project are in any way affiliated with or sponsored by Red Hat®, Inc.