Quick Starting the Apache Web Server


If Apache wasn't installed during the Fedora installation, you can install it later from the DVD or CDs that come with this book. You will need the httpd package and optionally the httpd-manual package (named apache and apache-manual in earlier versions).

Note 

It is possible for a new version of Apache to be released before an equivalent Fedora package is available. Or perhaps you'd prefer to customize the server's compile-time options and build Apache directly from the Apache source code (SRPMS) that come with Fedora.

Here's a quick way to get your Apache Web server going. From here, you'll want to customize it to match your needs and your environment (as described in the section that follows ).

  1. Make sure that Apache is installed by typing the following from a Terminal window:

     $  rpm -qa  grep httpd  system-config-httpd-1.3.3-1.1 httpd- devel -2.2.0-5.1.2 httpd-2.2.0-5.1.2 httpd-manual-2.2.0-5.1.2 

    The version number you see may be different. You need only the httpd package to get started. I recommend httpd-manual because it has excellent information on the whole Apache setup. The httpd-devel package includes the apxs tool for building and installing extension modules. The system-config-httpd package contains a GUI-based Apache Configuration tool.

  2. A valid host name is recommended if it is a public Apache server (for example, abc.handsonhistory.com ). If you don't have a real, fully qualified domain name, you can edit the /etc/httpd/conf/httpd.conf file and define the ServerName as your computer's IP address. Open the httpd.conf file (as the root user ) in any text editor, search for the line containing ServerName www.example.com:80 , and uncomment it. It should appear as follows:

     ServerName www.example.com:80 

    To make the Web server available to your LAN, you can use your IP address instead of www.example.com (for example, ServerName 10.0.0.1 ). The :80 represents the port number (which is the default). For a public Web server, get a real DNS hostname. (Refer to Chapter 25 for information on DNS and making a server public.) No changes are required to this file to make apache available on the local host.

  3. Add an administrative e-mail address where someone can contact you in case an error is encountered with your server. In the /etc/httpd/conf/httpd.conf file, the default administrative address appears as follows:

     ServerAdmin root@localhost 

    Change root@localhost to the e-mail address of your Apache administrator.

  4. Start the httpd server. As root user, type the following:

     #  service httpd start  

    If all goes well, this message should appear: Starting httpd: [OK] . Now you're ready to go.

  5. To have httpd start every time you boot your system, run the command as root user.

     #  chkconfig httpd on  
  6. To make sure that the Web server is working, open Firefox (or another Web browser) and type the following into the location box and press Enter:

      http://localhost/  
  7. You should see the Test Page for the Apache Web server, as shown in Figure 21-1. To access this page from another computer, you will need to enter your Apache server's host name or IP address.

    Tip 

    It is not necessary to be connected to a network (or even to have a network connection) just to test the server or to view the files on your local apache machine. Rather than specify the server's real name in the URL, just use "localhost" (that is, http://localhost/) from a browser on the same computer. In fact, it's best to fully test the configuration before making the server accessible on an unprotected network.

  8. The Test Page is actually an error condition, indicating that you haven't added any content to your Web site yet. To get started, you can add an image from book  index.html file that contains your own home page content in the /var/www/html directory. Then you can continue to add your own content to that directory structure.

image from book
Figure 21-1: Appearance of the Test Page indicates that the Apache installation succeeded.

Now that your Web server is working (or at least, I hope it is), you should step through the next section. It helps you understand how to set up more complex Web server arrangements and protect your server from misuse. Stepping through that section will also help you troubleshoot your Web server, in case it isn't working.

Tip 

If your Web server is accessible from your local host, but not available to others from your LAN or the Internet, you may need to change your firewall rules to allow greater access. Appendix B explains how to make your Web or other server accessible. In particular, you need to open tcp port 80.




Fedora 6 and Red Hat Enterprise Linux Bible
Fedora 6 and Red Hat Enterprise Linux Bible
ISBN: 047008278X
EAN: 2147483647
Year: 2007
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net