Microsoft KB Archive/323956

= HOW TO: Control an Apache for Windows Service During a UNIX-to-Windows Migration =

PSS ID Number: 323956

Article Last Modified on 12/18/2003

-

The information in this article applies to:


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Professional
 * Microsoft Small Business Server 2000
 * Microsoft Internet Information Services 5.0

-



This article was previously published under Q323956



IN THIS TASK

 * SUMMARY
 * ** Starting and Stopping Apache
 * Starting Apache as a Service
 * Starting Apache from the Command Line
 * Controlling Apache from the Command Line
 * REFERENCES



SUMMARY
This article describes how to start, stop, and control Apache if you install the Apache for Windows component as part of the migration process. Specifically, this article describes how to start Apache as a service and as a standalone command-line program and how to control an Apache service that is already running.

back to the top

Starting and Stopping Apache
You can run Apache in either of the following ways:
 * Run Apache as a Windows 2000 service if you want Apache to start automatically when you start the computer or if you want to keep the service running even when you are not logged on.
 * Run Apache as a console program if you are using Apache primarily only for testing.

To start and stop Apache, use the command-line tools in a command prompt. To open a command prompt, click Start, point to Program Files, point to Accessories, and then click Command Prompt. To quit a command prompt at any time, either close the window or type exit at the command prompt.

back to the top

Starting Apache as a Service
To start Apache as a Windows 2000 service, run the following command at a command prompt, where  is the name that you want to use to identify the service:

apache -k install -n

The default service name of the service is &quot;Apache.&quot; You can create as many different Apache services as you want, but you must give each service a different name.

To use a configuration file other than the default file when you start Apache as a service, run the following command:

apache -k install -n  -f \ \conf\ .conf

To remove an Apache service, run the following command:

apache -k uninstall -n

back to the top

Starting Apache from the Command Line
To start Apache from the command line, run the following command from a command prompt:

apache

By default, Apache opens the configuration file in Conf/Httpd.conf. To select a different configuration file, run the following command from a command prompt:

apache -f \conf\ .conf

back to the top

Controlling Apache from the Command Line
To control an Apache service that is already running from the command line, specify the service name, and then send any of the following commands to the Apache server:
 * start: Use this command to start the service.
 * shutdown: Use this command to stop the service.
 * restart: Use this command to stop the service, reload the configuration file (this step is required after you change the file), and then restart the service.

For example, to control the Apache service, run any of the following commands:
 * apache -n  -k start
 * apache -n  -k restart
 * apache -n  -k shutdown

To control a command-line instance of Apache, run the following command (omit the service name):

apache -k shutdown

back to the top

