Previous Page | Next Page

  1. Introduction
  2. About Linux
  3. Installation and getting started
  4. Logging in and out
  5. Basic Linux Commands
  6. Linux Files and File Permissions
  7. Linux Directory Structure
  8. Finding Files
  9. Linux Help
  10. Setting Time
  11. Devices
  12. Tips
  13. Accessing Other Filesystems
  14. Accessing Removable Media
  15. Making and Managing Filesystems
  16. Emergency Filesystems and Procedures
  17. LILO and Runlevels
  18. Init
  19. Environment, Shell Selection, and Startu
  20. Linux Kernel
  21. Package Installation and Printing
  22. Configuration, Logging and CRON
  23. Keys and Terminal Configuration
  24. Sound Configuration
  25. Managing Users
  26. Passwords
  27. Process Control
  28. Configuration and Diagnostic Tools
  29. Overall Configuration
  30. Using PAM
  31. Basic Network Setup
  32. Tools and Terms
  33. Novell and Printing
  34. Inetd Services
  35. Xinetd Services
  36. Other Network Services
  37. FTP and Telnet
  38. Samba
  39. Identd (auth)
  40. X Configuration
  41. X Use
  42. Using X Remotely
  43. X Documentation
  44. DNS
  45. DHCP and BOOTP
  46. Apache
  47. NFS
  48. PPP
  49. Mail
  50. Routing
  51. IP Masquerading
  52. Proxy Servers and ipchains
  53. UUCP
  54. News
  55. NIS
  56. Network Security
  57. Secure Shell
  58. Text Processing
  59. Shell Programming
  60. Emacs
  61. VI
  62. Recommended Reading
  63. Credits

Apache Web Server


The apache web server is called "httpd". The configuration files for it for many systems are in "/etc/httpd/conf". Their names are httpd.conf, srm.conf, access.conf, mime.types, and magic. The file srm.conf specifies the directory location of the root document with the "DocumentRoot" statement. The "DirectoryIndex" statement gives the name of the starting file. The file access.conf, is used to control user access to various html files. On my system, the initial startup file is "/home/httpd/html/index.html". Documentation is in /home/httpd/html/manual.

Apache Installation

There are many options that can be selected when installing Apache. Among them are selection of the modules to be compiled with the apache web server. This will be commented on at the appropriate installation step. In my installation, I installed Apache with PHP and mysql support. To get the Apache compile to work with mysql support, it was necessary for mysql to be installed from the source. When mysql was installed from binary, the apache compile failed. Here's the installation steps for installing Apache from a tarred and zipped source file:

  1. Copy the source file to "/usr/src" or "/usr/local/src". The source file is called something like apache_1_3_19_tar.gz.
  2. Type "cd /usr/src" or "cd /usr/local/src" depending on where you copied your file.
  3. Type "tar xvzf apache_1_3_19_tar.gz" to decompress the source file. The directory, "apache_1.3.19" is created.
  4. Type "ln -s apache_1.3.9 apache" to create a software link to the apache directory.
    1. If installing PHP support with apache, copy the PHP source file "php-4_0_4pl1.tar.gz" from to "/usr/src" or "/usr/local/src".
    2. Type "tar xvzf php-4_0_4pl1.tar.gz" to decompress the source file.
  5. Type "cd apache".
  6. Documentation at the web site indicates to enter the "src" directory to perform the configuration and compile. However by reading the "INSTALL" files in the apache and apache/src directories, it can be done from inside the src directory or from the main apache directory. Either approach will work. There are various advantages and disadvantages to each approach. Compiling from inside the "src" directory allows easier module control by allowing the changing of the "Configuration" file. If done from the main directory, modules to be included or excluded from the default setting must be included on the command line. I have chosen to do the install using the "configure" file in the main directory since documentation indicates that some parameters may be overridden here and I am making no changes to the default included modules. If you want to install PHP support, there is a way to do it as documented in PHP INSTALL file, but I have not outlined that procedure here and have assumed you will be performing the install from the main directory if installing PHP. If you want to change the default modules by compiling in the "src" directory, follow the subset of instructions below.
    1. Type "cd src".
    2. Edit the file "Configuration" file.
    3. Type "./Configure". I do not believe you can use the options "--sysconfdir" and "--logfiledir" to specify configuration and loglile locations as I have done below.
    4. Skip the next step (Step 7).
  7. Type "./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd/conf --logfiledir=/var/log/httpd". I have added the "--sysconfdir" option to set the location where the apache configuration files will be, and the "--logfiledir" option to set the location of where logging information is written for apache. If you are making changes to the default modules use the additional command line parameters "--enable-module=NAME" and "--disable-module="NAME" where "NAME" is the name of the module to be enabled or disabled. Read the "INSTALL" file in the main directory for more information here and read the "src/Configuration" file to see what the module names are. If installing PHP support follow the subset of instructions below.
    1. Type "cd .."
    2. Type "cd php-4.0.4pl1"
    3. Type "./configure --with-mysql=/usr/local/mysql --with-apache=../apache --enable-track-vars". This assumes you've already installed mysql in the "/usr/local/mysql" directory.
    4. Type "make".
    5. Type "make install".
    6. Type "cd ../apache".
    7. Type "./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd/conf --logfiledir=/var/log/httpd --activate-module=src/modules/php4/libphp4.a"
  8. Type "make". Note: When I did my install, I got a compile error related to the mysql installation. If you installed the binary version of mysql, you may need to install it from the source version.
  9. Type "make install". If installing PHP support follow the subset of instructions below.
    1. Type "cd ../php-4.0.4pl1".
    2. Type "cp php.ini-dist /usr/local/lib/php.ini".
    3. Edit "/etc/httpd/conf/httpd.conf" or "/etc/httpd/conf/srm.conf" and add the following line:

      AddType application/x-httpd-php .php


At this point it is time to set up the apache configuration by modifying the apache configuration files and setting apache to start automatically. The apache configuration files are:

  1. httpd.conf - This is the main configuration file. It is used to specify where the document root for the web server is found, various server parameters, directory permissions, where mime types for files are found, and addition of application type definitions and the associated handler for each application.
  2. srm.conf - This file is used to configure apache server directives. These directives are now recommended to be put in the httpd.conf file.
  3. access.conf - This file is used to control directory access and who can access the directories. The directory access control is now recommended to be put in the httpd.conf file.

Specific configuration parameters:

  • Specification of the document root where the HTML main web page, "index.html" should be found. This line should look like:

    DocumentRoot "/home/httpd/html"

  • Additional parameters including:
    • ServerRoot - Specifies where the servers main directory is.

      ServerRoot "/usr/local/apache"

    • ErrorLog amd Loglevel- Specifies where the web server will keep its error log file and the level at which errors are kept. Loglevel options are debug, info, notice, warn, error, crit, alert, and emerg.

      ErrorLog /var/log/httpd/error_log
      LogLevel warn

    • Keep alive - Specifies whether persistant connections are to be supported.

      KeepAlive On

    • KeepAlive Requests 100 - The maximum keep alive requests to be supported.
    • KeepAliveTimeout 15 - The number of seconds the connection is kept alive if no additional requests are received from the client.
    • The maximum and mininum number of servers that may be created to wait for client requests and the number of servers to start when the web server starts.

      MinSpareServers 5
      MaxSpareServers 10
      StartServers 5

    • MaxClients 150 - The maximum number of clients that may connect at one time to the web server.
    • Port 80
    • The user and group the web server is run as.

      User nobody
      Group nobody

  • Directory permission entries are used to define various directory options and permissions. These entries appear similar to the following which defines the permissions for the document root directory:

    <Directory />
    Options FollowSymLinks
    Allow Override None

    Parameters include:

    • AllowOverride
    • AuthConfig
    • FileInfo
    • Limit

    Options include:

    • ExecCGI - Allows CGI programs in the directory to be executed.
    • FollowSymLinks
    • Includes
    • Indexes
    • MultiViews
    • None - No options
    • All - All options except MultiViews
  • Permissions - Are set with statements such as:

    Order deny, allow
    Deny from all


    Order allow, deny
    Allow from all

    <Limit> and </Limit> tag pairs along with <LimitExcept> and </LimitExcept> tags are set with options such as:

    • GET
    • POST
  • <Files> and </Files> tag pairs can be set to limit access to specific file types the same as is done with directory entries above.
  • CGI Driectory definition which defined what directory CGI application files are kept in and can be used to run these files. Other directories can be specified to allow the execution of CGI files if the ExecCGI option is specified in these directory entries.

    <Directory "home/httpd/cgi-bin">
    Allow Override None
    Options None
    Order allow, deny
    Allow from all

  • AddType and Add handler statements. These statements allow file types and associated programs to handle these file types. You will linely need this set of entries to run PHP.

    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

    To run server parsed SHTML files you will need:

    AddType text/html .shtml
    AddHandler server-parsed .shtml

This is just a partial list of common apache web server options. For a more complete guide, including setting up virtual hosts, refer to the Apache web server documentation.

Getting user filled out form data from the web

There are many types of programs that can be written to do this:

  1. Perl CGI scripts
  2. Shell CGI scripts
  3. PHP scripts that are scripts run on the server side when the page is requested. PHP code is embedded in the HTML page, but files are labeled with the .php extension.
  4. Java Servlets
  5. Compiled programs based on any language.

The CGI Environment:

The Web server fills in a standard list of environment variables when it runs. It writes to other environment variables when it is requested to. Since the Apache server always runs, anything it puts in the environment is readable by other programs, such as a Perl script program. This is possible as long as the other program knows the names of the variables to be read.


  • CGI - Common Gateway Interface. A set of rules (interface) for scripting and exchanging data over the web.
  • SGML - Standard Generalized Markup Language. HTML is an application of this.
  • URL - Universal Resource Locator. Includes protocol (HTTP, FTP, FILE, GOPHER), module name, path name of object.
  • IIS - Microsoft's Internet Information Server (A web server for NT)
  • IDC - Internet Database Connector
  • ISAPI - Microsoft web programming (Internet Server Application Programming Interface)