dcsimg

How to stop, start, remove, or install an Apache web server service from the command line

Products

Webtrends Analytics 8.0x
Webtrends Enterprise 7.5
Webtrends Professional 7.5
Webtrends Small Business 7.5

Cause

Upon the installation of Webtrends 7.0, the Apache 2.0 web server is installed and the service is started. If there is ever a need to stop, start, remove, or install the Apache service via command line, the following commands apply.
Note: Apache can be run as a service on Microsoft Windows NT, 2000, XP, and 2003. Normal starting, restarting, and shutting down of an Apache service is usually done via the Apache Service Monitor, by using commands like “NET START Apache2” and “NET STOP Apache2”, or via normal Windows service management.

Resolution

Before starting Apache as a service by any means, test the service’s configuration file by using:

apache -n “MyServiceName” -t
  • Start Apache via command line switches – apache -k start
  • Stop an Apache service via command line switches – apache -k stop Or apache -k shutdown
  • Restart a running service and force it to reread its configuration file – apache -k restart
  • Install Apache as a Windows service – Enter the following from the command prompt at the Apache bin subdirectory (\Webtrends\common\apache\bin): apache -k install
  • Specify the name of the service – If you need to specify the name of the service you want to install, use the following command. This is done if you have several different service installations of Apache on your computer: apache -k install -n “MyServiceName”
  • To install specifically named configuration files for different services – apache -k install -n “MyServiceName” -f “c:\files\my.conf” If you use the first command without any special parameters except -k install, the service will be called Apache2 and the configuration will be assumed to be conf\httpd.conf.
  • Remove an Apache service – To remove an Apache service enter the following from the command prompt at the Apache bin subdirectory (\Webtrends\common\apache\bin): apache -k uninstall
  • Specify the specific Apache service to be uninstalled – apache -k uninstall -n “MyServiceName” By default, all Apache services are registered to run as the system user (the LocalSystem account). The “LocalSystem” account has no privileges within your network via any Windows-secured mechanism, including the file system, named pipes, DCOM, or secure RPC. It has, however, wide privileges locally.

More Information

Apache comes with a utility called the Apache Service Monitor. With it you can see and manage the state of all installed Apache services on any machine on your network. To be able to manage an Apache service with the monitor, first install the service (either automatically via the installation or manually). The Apache Service monitor is found in the following location:

\Webtrends\common\apache\bin

Double-click the ApacheMonitor.exe executable and an icon will appear on the Windows taskbar.

For further Apache documentation on the Apache service on Windows, click the link below:

http://httpd.apache.org/docs-2.0/platform/windows.html#winsvc