View the printer
friendly version of this document
|
Installing the Apache Web Server for Local Development
For: All Windows Versions
Revised: January 15, 2004
Important: The Java application server and MySQL database are not included as
part of the kinetic Service annual fee. These technologies are available on an
as-requested basis for an additional fee. Contact David Drum at
david@more.net
or (800) 509-6673 for additional information.
Contents
Overview
This document details how to install the Apache web server
for web site development. This version of Apache is provided
as a service to customers of MOREnet for creating a development
environment that closely matches MOREnet production servers.
Important: Individuals using MOREnet's distribution of Apache
must use it with the other local development environment distributions from
MOREnet to ensure a working environment. Do not mix and
match MOREnet's distributions with distributions from the official
software vendors. See
Local Development Overview for a complete list. Otherwise, please visit
the official Apache HTTP Server Project
web site to obtain a distribution.
Requirements
Your computer must meet the following requirements:
- A Windows system with approximately 25 MB of free hard drive
space for the installed application.
- You must have administrator access to your computer so you can
install software.
Download and Install Apache
- MOREnet has prepared an Apache distribution for web site
development. Download the Apache installation file
and temporarily save this executable file to a location on your
hard drive.
- If you have a previous version of Apache installed on your
system, uninstall the previous installation. Before you uninstall,
make sure that you save backup copies of any files you
modified in the installation such as the conf\httpd.conf
configuration file. You only need to save a backup copy if
you would like to reference your changes at a later time.
- Double-click the Apache installation file you downloaded earlier
to begin the new installation. The steps that follow detail the prompts
that you'll encounter during installation.
- The installer presents the Apache license (i.e. The Apache
Software License). Review the license and click I Agree
to continue the installation.
- The installer displays a list of installation types and components.
The Normal installation type is selected by default.
If you are using Windows NT, Windows 2000, or Windows XP, select the
NT Service component. Do not be alarmed that the installation
type of Custom is automatically selected when you select the
NT Service option. Running Apache as an NT service provides
optimum performance under these operating systems.
The Apache Start Menu Group component provides a list of
shortcuts on your Windows Start menu.
Click Next when you are finished selecting components.
- The installer displays the directory where Apache will be installed.
To install to a different directory, click Browse and select
a different location.
- Click Install to begin the installation.
Note: If you selected the NT Service option, you may
notice a command prompt window very quickly appear and disappear during
the installation. Do not be alarmed by this behavior. These appear
during the installation of the Apache service included
in this installation.
- The Apache Configuration Options window displays.
- Specify your e-mail address in the Administrator
E-mail Address option and then click Next.
- When the installation is complete, click Close.
- You may delete the Apache installation file that you
saved to a temporary location to save space on your hard drive.
- If you are installing Apache for web site and web application
development, proceed to the
Local Development section and follow the
installation instructions for the
Java 2 SDK, MySQL database server, and Tomcat application server.
When you are finished with the Tomcat installation, you can return
to this document and follow the
Starting and Stopping Apache and
Developing Your Web Site sections.
If you are installing Apache for web site development only, continue
to the next step.
- Copy your web site files to the C:\WebPublish\localhost\www
directory for testing. More information about this directory
is provided in the Developing Your Web Site
section of this document.
- Proceed to the Starting and Stopping Apache
section and start Apache according to the instructions for your
operating system. After you have started Apache, visit the following
URL to see your web site:
http://localhost:8080/
Starting and Stopping Apache
The MOREnet distribution of Apache includes shortcuts to start and
stop Apache. Click Start, Programs, Apache HTTP Server {version}
to see these shortcuts.
Starting and Stopping Apache in a Command Prompt Window
(Windows 95, Windows 98, and Windows ME)
The following shortcuts start and stop Apache in an MS-DOS command prompt
window using batch files. You may use these shortcuts on any system. However,
these are primarily for the systems indicated above that do not support
running Apache as an NT service. Running Apache in an MS-DOS command prompt
window results in slower performance compared to Apache running as an NT
service.
Click Start, Programs, Apache HTTP Server {version}, Control Apache
Server Batch to see the following shortcuts:
- Start Apache Batch. This shortcut starts Apache in
an MS-DOS command prompt window.
- Restart Apache Batch. This shortcut restarts Apache in
an MS-DOS command prompt window if it is already running. You may
need to restart Apache if you modify any of its configuration files
while it is running.
- Stop Apache Batch. This shortcut stops Apache if it was
started with the Start Apache Batch shortcut.
Starting and Stopping Apache as an NT Service
(Windows NT, Windows 2000, Windows XP)
The following shortcuts start and stop the Apache NT service. Click
Start, Programs, Apache HTTP Server {version}, Control
Apache Server Service to see these shortcuts:
- Start Apache Service. This shortcut starts the
Apache NT service.
- Restart Apache Service. This shortcut restarts the
Apache NT service.
- Stop Apache Service. This shortcut stops the
Apache NT service.
The Apache service is configured with a Startup Type setting of
manual so that you must manually start the service when you want it
to run. It will not run automatically when your system is started. You can
change this setting, as well as start and stop the service, with tools
available on your system. To see your system's services and change the
Startup Type settings, do the following:
- In Windows 2000, select Start, Settings, Control Panel and
then select Administrative Tools. Within the Administrative
Tools window, select Services. Right-click the service
name and then select Properties. Change the Startup Type
option to Automatic.
- In Windows NT, select Start, Settings, Control Panel and
then select Services. Click the service name in the list
to highlight it and then click the Startup...
button. Change the Startup Type option to Automatic.
Developing Your Web Site
The MOREnet distribution of Apache is configured so that your
web site files are served from the C:\WebPublish\localhost\www
directory. This is the root directory for web site content. Note that this
directory naming convention is analogous to the directories you must
navigate on a production server as discussed in
Introducing Your kinetic Service
Web Site. However, unlike a production server, you can easily create
and test your web site in this location without transferring files to
a server to see each minor change. When you are finished testing, FTP
your files to the production server for public viewing.
To test your web site, start Apache and visit the following URL
in a browser:
http://localhost:8080/
Reviewing Your Apache Logs
As you run Apache and begin working on your web site and web
applications, you may trigger errors that throw exceptions in Apache.
Apache's error logs are excellent resources for troubleshooting
errors. If you explore the C:\WebPublish\locahost\logs directory,
you'll see these files:
- access.log
- error.log
- mod_jk.log
The access.log file contains information about the requests
to your web server. The error.log file contains errors listed
by the web server. The mod_jk.log file contains items related
to the connector that links your Tomcat application server to the Apache web
server. All of the logs are text files, so you can view them with Notepad or
Wordpad. You may quickly review the access.log or
error.log files by clicking Start, Programs,
Apache HTTP Server {version}, Review Server Log Files and selecting
the appropriate shortcut.
Configuring Apache
Reviewing the Apache Configuration
The MOREnet distribution of Apache automatically configures your
web server during the installation. You may review these settings by
using a text editor like Notepad or Wordpad to view the
conf\httpd.conf file within your Apache installation.
Documentation for Apache settings is available on the
Apache web site.
Important: The MOREnet distribution is configured to behave
as closely as possible to production servers. If you make modifications
to your server's configuration, you may introduce behaviors that are
inconsistent with the production servers.
Configuring Apache for Non-local Access
The MOREnet distribution of Apache is configured so that the web
server may only be accessed from the local system. This configuration
provides a measure of security since your web server cannot be accessed
from any other computer except itself. However, if you would like
others to be able to access your server, or set up a test
system for access in a workgroup setting, you must modify your Apache
configuration.
Important: Before you make any changes, save a backup
copy of your existing configuration in case you need to use it
again.
Follow these steps:
- Use a text editor like Windows Notepad or Wordpad to open
the conf\httpd.conf file within your Apache installation.
- Find the
Listen localhost:8080 statement at the
top of the file. This statement instructs Apache to only listen
for requests to the localhost host name
on port 8080. The localhost name is special
because it is reserved to designate the IP address of 127.0.0.1
and is available for testing on most systems.
- Replace
localhost with the IP address or registered
host name of your computer.
Important: If you use a host name instead of an IP address,
it must be the host name registered to your computer. You cannot
make up a host name and expect it to work. It must be a registered
host name.
- Find the
<VirtualHost localhost:8080> statement
at the bottom of the file. Replace localhost with the
IP address or registered domain name of your computer.
- At this point, the Apache configuration allows your web server
to be accessible by anyone on the Internet. To make it more secure,
continue to the next step to add an .htaccess access
control file in the root of your web site to limit access to your
web server by IP address or IP address range.
- Use Windows Explorer to view the root of your web site in the
C:\WebPublish\localhost\www directory.
- Open a text editor like Windows Notepad or Wordpad.
- Create a new file and add the following statements:
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from {xxx.xxx.xxx.xxx}
Replace {xxx.xxx.xxx.xxx} with the IP address of the
system that you want to allow access to your web server. If you
need to allow access from multiple systems, you may add as many
Allow statements as needed. If you need to provide
access for many systems that reside on the same network, you
can replace the specific IP address with a partial IP address
to limit access to a range of IP addresses (a subnet). For example,
Allow from 207.160.133 allows access to all systems that
have an IP address in the 207.160.133 subnet.
Note that the Allow from 127.0.0.1 statement
allows access from the local system. Although the local system
may exist on the subnet or a specific IP address that you add
with an Allow statement, requests to the web server from the
local system will be seen as requests from the 127.0.0.1 reserved
localhost IP address. Without this statement, you cannot access
the server from the local system.
- Save the file with a .htaccess filename. Windows does
not typically allow you to save a file without the first part of
the filename. However, when you attempt to save the file with
Notepad or Wordpad, enclose the filename with quotation
marks (i.e. ".htaccess") to force Windows to save
it with the proper name.
- Stop and restart Apache so your changes to its
configuration file take effect.
Modifying the Location of Apache Logs and Web
Site Files
As discussed in the Developing Your Web Site
and Reviewing Your Apache Logs sections,
the MOREnet distribution of Apache is configured so that your web site
files are served from the C:\WebPublish\localhost\www
directory and your Apache log files are stored in the
C:\WebPublish\localhost\logs directory. This directory
structure is analogous to the directories you must navigate on a
production server. Although this structure is used by default, it is
not mandatory that you continue to use this exact directory structure
or have it located on the C: drive. You can modify the locations
of your web site files and logs in the conf\httpd.conf file located
within your Apache installation.
Caution: If you modify the directory structure, you may
accidentally modify the behavior of Apache and how it works with
Tomcat (if you're also using the Tomcat application server).
In addition, changing the directory structure will make your local
development environment unlike the structure on
production servers and this may cause confusion.
MOREnet advises that if you must change the locations of logs
and web site files, refrain from modifying the directory
structure and only change the drive. You can copy the
existing C:\WebPublish directory structure
to another drive to maintain it, and then follow the directions
below. By doing this, you only need to add the new drive
letter to the configuration settings.
Important: Before you make any changes, save a backup
copy of your existing configuration in case you need to use it
again.
To change the locations, open the conf\httpd.conf file
in a text editor and search for "WebPublish". In each location where
you find "WebPublish", modify the path to point to the location you
want to use. Note that all paths must use the forward
slash character (/) between directories instead of the backslash (\)
character. Also, if you use a path that has whitespace in it, enclose
the entire path in quotation marks. When you are finished editing,
save the file and restart Apache. Note that the directories you specify
must exist or Apache will not start.
Important: The
Using
Apache with Windows document from the Apache Software
Foundation indicates that the Apache service is registered to run as
the system user and it will not have access to network resources
such as a network file system. If you configure Apache to use
a network drive for serving your web site files or saving logs,
the Apache service may not run when you attempt to start it.
|