Installing / Configuring the Apache Web Server (Release 1.3.27)
by Jeff Hunter, Sr. Database Administrator
The Apache Web Server source code can be downloaded from the Apache Web Site. The software is located at: http://httpd.apache.org/download.cgi.
Simply download the file apache_1.3.27.tar.gz (or equivalent version) and place it in a temporary directory.
This section of the document will make the following assumptions:
One decision you have to make is whether to use mod_jserv or mod_jk as the linking mechanism between Apache and Tomcat. Unless you can find a binary distribution of Apache with DSO support enabled (and I have searched long and hard), you will have to follow these instructions to build it yourself.
- The installation of the Apache Web Server will be performed as the "root" userid.
- The installation of the Apache Web Server will be performed from the /tmp directory. When downloading the Apache Web Server source code, download it to the /tmp directory.
- The Apache Web Server will be installed to /u02/app/apache.
- The Apache Web Server will be run on well-known port 80, and will therefore need to be started and stopped as the UNIX "root" userid.
- The Apache Web Server will run as any user. Since most of my installations will reference an Oracle database, I the "oracle" userid and group "dba".
Apache has added to the number of connection mechanisms to integrate the Apache HTTP server and the Tomcat Servlet container. The only choices with Apache 1.3 were to use mod_jserv or mod_jk. With Apache 2.0 you now have the following options:
# su - # mkdir /u02/app/apache # cd /tmp # gunzip apache_1.3.27.tar.gz # tar xvf apache_1.3.27.tar # cd apache_1.3.27 # ./configure --prefix=/u02/app/apache --enable-module=most --enable-shared=max # make # make install # rm -rf /tmp/apache_1.3.27
Configuring the Apache httpd.conf File
Configuring the Apache Web Server mainly includes making edits to the /u02/app/apache/conf/httpd.conf file.
The following listing is an example httpd.conf file that details the changes you may want to make.
All needed changes to this file are in BOLD/UNDERLINE.
Keep in mind that this listing IS NOT a complete listing of the httpd.conf file. (e.g. Do not try to simply copy/paste this entire listing in place of your current httpd.conf file.) ONLY the changes are listed! The changes documented below configure the Apache Web Server to:
- Change the port number (called Listen in Apache 2.0) from its default (8080) to run on port 80.
- I normally have the Apache Web Server run as the "oracle" userid and group "dba".
- Have the main DocumentRoot set to /u02/app/apache/WebDBA.
- Allow CGI programs to be run from any directory.
- Allow Server Side Includes.
- Allow the Apache Web Server to recognize index.html, index.htm, index.shtml, and index.cgi.
- CGI Scripts will be recognized by the filename extensions .cgi and .pl.
- Have the Apache Web Server parse filenames with extensions .shtml and .inc before returning the page to the browser.
# # Port: The port to which the standalone server listens. For # ports < 1023, you will need httpd to be run as root initially. # # OLD VALUE: Port 8080 Port 80 # # If you wish httpd to run as a different user or group, you must run # httpd as root initially and it will switch. # # User/Group: The name (or #number) of the user/group to run httpd as. # . On SCO (ODT 3) use "User nouser" and "Group nogroup". # . On HPUX you may not be able to use shared memory as nobody, and the # suggested workaround is to create a user www and use that user. # NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET) # when the value of (unsigned)Group is above 60000; # don't use Group nobody on these systems! # # OLD VALUE: User nobody # OLD VALUE: Group nobody User oracle Group dba # (Simply uncomment the the line) # OLD VALUE: # ServerName dbaprod.comanage.net ServerName www3.idevelopment.info # # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # # OLD VALUE: DocumentRoot "/u02/app/apache/htdocs" DocumentRoot "/u02/app/apache/WebDBA" # # This should be changed to whatever you set DocumentRoot to. # # OLD VALUE: <Directory "/u02/app/apache/htdocs"> <Directory "/u02/app/apache/WebDBA"> # # This may also be "None", "All", or any combination of "Indexes", # "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews". # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # OLD VALUE: Options Indexes FollowSymLinks MultiViews Options Indexes FollowSymLinks ExecCGI Includes MultiViews # # This controls which options the .htaccess files in directories can # override. Can also be "All", or any combination of "Options", "FileInfo", # "AuthConfig", and "Limit" # # OLD VALUE: AllowOverride None AllowOverride All # # Controls who can get stuff from this server. # Order allow,deny Allow from all </Directory> # # DirectoryIndex: Name of the file or files to use as a pre-written HTML # directory index. Separate multiple entries with spaces. # <IfModule mod_dir.c> # OLD VALUE: DirectoryIndex index.html DirectoryIndex index.html index.htm index.shtml index.cgi </IfModule> # # AddHandler allows you to map certain file extensions to "handlers", # actions unrelated to filetype. These can be either built into the server # or added with the Action command (see below) # # If you want to use server side includes, or CGI outside # ScriptAliased directories, uncomment the following lines. # # To use CGI scripts: # # OLD VALUE: #AddHandler cgi-script .cgi AddHandler cgi-script .cgi .pl # # To use server-parsed HTML files # # OLD VALUE: #AddType text/html .shtml # OLD VALUE: #AddHandler server-parsed .shtml AddType text/html .shtml AddHandler server-parsed .shtml .html .htm .inc # You can (optionally) setup one or more Virtual Hosts. NameVirtualHost 192.168.1.110 <VirtualHost 192.168.1.110> ServerAdmin firstname.lastname@example.org DocumentRoot /var/www/WebDBA ServerName dbaprod.idevelopment.info ErrorLog logs/WebDBA-error_log TransferLog logs/WebDBA-access_log </VirtualHost> <VirtualHost 192.168.1.110> ServerAdmin email@example.com DocumentRoot /var/www/OracleDocs817 ServerName oracledocs817.idevelopment.info ErrorLog logs/OracleDocs817-error_log TransferLog logs/OracleDocs817-access_log </VirtualHost> <VirtualHost 192.168.1.110> ServerAdmin firstname.lastname@example.org DocumentRoot /var/www/OracleDocs901 ServerName oracledocs901.idevelopment.info ErrorLog logs/OracleDocs901-error_log TransferLog logs/OracleDocs901-access_log </VirtualHost>
Starting / Stopping Apache Web Server
To start the Web Server, log in as the root account and run the following: (provided your PREFIX is /u02/app/apache).
# su - # /u02/app/apache/bin/apachectl startStopping Apache
To shut down the Web Server, log in as the root account and run the following: (provided your PREFIX is /u02/app/apache).
# su - # /u02/app/apache/bin/apachectl stop