Configuring Apache

It's easiest to configure Apache using Red Hat Linux 6's Linux Configuration applet, as explained in this section. However, they may be times when you need to directly edit the Apache configuration file, /etc/httpd/conf/ httpd.conf. For information on directly editing the Apache configuration files, see "Using Apache Configuration Directives" later in this chapter.

To set Apache defaults:

1.
Log on as root.

2.
Open the Linux Configuration applet.

3.
Select Defaults from the Apache Web Server section.

The Apache Defaults tab will open ( Figure 14.10 ).

Figure 14.10. Apache can be configured using the Apache Defaults tab in the Linux Configuration applet.


4.
Enter a name for the server.

The default name is localhost.

5.
If you want to change the default Apache document root—the base directory that will be used to store the site's HTML files—enter a new document root.

If you leave this field blank, the documents in your site will be rooted at the default directory, /home/httpd/html.

6.
If you are going to be using CGI scripts, you need to enter a script alias. Scripts should not be run from the same directory as HTML documents, because if they are, they are vulnerable to being read.

For the Script Alias entry, first indicate what the scripts will be invoked as and then the physical path translation. For example if you enter

/cgi-bin/ /www/king/public/bin/ then in the Web site HTML, a script invoked as

http://www.kingdomofsierras.com/cgi-bin/script.pl would physically be located in the /www/king/public/bin/ directory.

Note that the default configuration is set to listen on port 80.

7.
Scroll down until the Features check boxes come into view ( Figure 14.11 ).

Figure 14.11. Important options can be enabled using the Features check boxes.


8.
Select Host Name Lookups if you want the domain names of site browsers, rather than the corresponding IP addresses, to appear in the Apache logs.

As the Apache documentation puts it, this is an option that for the sake of the Internet one should have to turn on—which is why by default it is off.

9.
If you plan to use server-side includes (SSIs), select Server Side Includes (for more information see the sidebar "Server-side includes" earlier in this chapter).

10.
If you plan to run CGI scripts, select May Execute CGI

11.
Click Accept.

12.
When prompted, activate the changes.

Tip

If a directory is named in an HTTP GET command rather than a specific HTML file, then Apache will open the file named index.html in that directory. For example, the file served in answer to the request

http://www.kingdomofsierras.com

will be index.html in the document root that applies to

http://www.kingdomofsierras.com


Tip

If you just want to start playing around with Apache and have no need for it to respond to requests made to a specific named host, you do not need to modify the default configuration. Just start building your site, starting at /home/httpd/html and invoking it as http://localhost/ or using the IP address.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.186.178