From b1db065a4d2a9cc4cbe580697050b626bb589c5f Mon Sep 17 00:00:00 2001
From: "William A. Rowe Jr" Running Apache as a service should only be done once you have successfully run
-it as a console application. See Using Apache with Microsoft Windows
-before you attempt to run it as a service.
- Apache can be run as a service on Windows NT/2000. (There is also some
+ HIGHLY EXPERIMENTAL support for similar behavior on
+ Windows 95/98, introduced with Apache 1.3.13). Apache can be run as a service on Win NT/2000. (There is also some HIGHLY EXPERIMENTAL
-support for a similar effect on Win95/98).
- Installing Apache as a service should only be done once you can
+ successfully run it in a console window. See
+ Using Apache with Microsoft Windows
+ before you attempt to install or run Apache as a service. Changes to the
+ httpd.conf file should always be followed by starting Apache as a console
+ window. If this succeeds, the service should succeed. NOTE: Prior to version 1.3.13, the configuration was not
+ tested prior to performing the installation, and a lack of
+ service dependencies often caused the console window to succeed, but the
+ service would still fail. See below if you are
+ having problems running a version of Apache prior to 1.3.13 to resolve the
+ issue. If you have this problem with version 1.3.13 or greater, first try
+ uninstalling (-u) and re-installing (-i) the Apache service. To start Apache as a service, you first need to install it as a
service. Multiple Apache services can be installed, each with a
different name and configuration. To install the default Apache
service named "Apache", run the "Install Apache as Service (NT only)"
option from the Start menu. Once this is done you can start the "Apache"
- service by opening the Services window (in the Control Panel), selecting Apache,
- then clicking on Start. Apache will now be running in the background. You
- can later stop Apache by clicking on Stop. As an alternative to using
- the Services window, you can start and stop the "Apache" service from the control
- line with
+ service by opening the Services window (in the Control Panel), selecting
+ Apache, then clicking on Start. Apache will now be running, hidden in the
+ background. You can later stop Apache by clicking on Stop. As an
+ alternative to using the Services window, you can start and stop the
+ "Apache" service from the command line with See Controlling Apache as a Service
+ for more information on installing and controlling Apache services. Apache, unlike many other Windows NT/2000 services, logs any
errors to it's own error.log file in the logs folder within the
Apache server root folder. You will not find Apache error
details in the Windows NT Event Log.
+ After starting Apache as a service (or if you have trouble starting it)
+ you can test it using the same procedure
+ as for running in a console window. Remember to use the command: to assure you are using the service's configuration.
+ Note: The -n option to specify a service name is only available
+ with Apache 1.3.7 and later. Earlier versions of Apache only
+ support the default service name 'Apache'. You can install Apache as a Windows NT service as follows: To install a service to use a particular configuration, specify the
+ configuration file when the service is installed: To remove an Apache service, use:
+ The default "service name", if one is not specified, is "Apache". Once a service is installed, you can use the -n option, in
+ conjunction with other options, to refer to a service's configuration file.
+ For example: To test a service's configuration file: To start a console Apache using a service's configuration file: Important Note on service dependencies: Prior to Apache release 1.3.13, the dependencies required to
successfully start an installed service were not configured.
@@ -128,31 +151,71 @@ To start a console Apache using a service's configuration file:
exists, and add the Rpcss entry to the list. Note on default "System account" (LocalSystem) that Apache will run under. When Apache is first installed as a service (e.g. with the -i option)
+ it will run as user "System" (the LocalSystem account). There should
+ be few issues if all resources for the web server reside on the local
+ system, but it has broad security privilages to affect the local machine! NEVER grant network privilages to the SYSTEM account!
+ Create a new user account instead, grant the appropriate privilages to
+ that user, and use the the 'Log On As:' option. Select the Start Menu ->
+ Settings -> Control Panel -> Services -> apache service ... and click
+ the "Startup" button to access this setting. The SYSTEM account has no privilages to the network, so shared pages or
+ a shared installation of Apache is invisible to the service. If you intend
+ to use any network resources, the following steps should help: If you allow the account to log in as a user, then you can log in yourself
+ and test that the account has the privilages to execute the scripts, read
+ the web pages, and that you can start Apache in a console window. If this
+ works, and you have followed the steps above, Apache should execute as
+ a service with no problems. Note: error code 2186 is a good indication that you need
+ to review the 'Log On As' configuration, since the server can't access a
+ required network resource.Running Apache for Windows as a Service
-
NET START APACHE
NET STOP APACHE
-See Signalling Service Apache when Running
-for more information on installing and controlling Apache services.
+
+ apache -n "service name"
+
+
+Running Apache for Windows as a Service
- Note: The -n option to specify a service name is only available
- with Apache 1.3.7 and later. Earlier versions of Apache only support
- the default service name 'Apache'.
-
apache -i -n "service name"
-To install a service to use a particular configuration, specify the
-configuration file when the service is installed:
+
apache -i -n "service name" -f "\my server\conf\my.conf"
-To remove an Apache service, use
+
apache -u -n "service name"
-The default "service name", if one is not specified, is "Apache".
-
-
+
apache -n "service name" -t
-To start a console Apache using a service's configuration file:
+
apache -n "service name"
-Important Note on service dependencies:
User Account for Apache Service to Run As (NT/2000)
- When Apache is installed as a service e.g. with the apache -i command, it will run
- as "System Account" (LocalSystem) user.
-
- docs say:
+
+ inherits the security context of the SCM. It is not associated with
+ any logged-on user account and does not have credentials (domain name,
+ user name, and password) to be used for verification.
+
+
+
LocalSystem is a very privileged account locally, so
you shouldn't run any shareware applications there.
However, it has no network privileges and cannot leave
the machine via any NT-secured mechanism, including
file system, named pipes, DCOM, or secure RPC.
-
- and:
-
+
+
+
A service that runs in the context of the LocalSystem account
- inherits the security context of the SCM. It is not
- associated with any logged-on user account and does not have
- credentials (domain name, user name, and password) to be used
- for verification. This has several implications: [... removed ...]
-
- That _really_ sucks. Can we recommend running Apache as some
- other user?
-
- Recommendations to be added...
-
+
+
+
+
+Troubleshooting Apache for Windows as a Service
@@ -168,36 +231,17 @@ To start a console Apache using a service's configuration file:
for Testing Apache at the Command Prompt.
Note on error code 2186. -
-If you encounter error 2186 when trying to start Apache, the following workaround may help; -
-- Select the service in Control Panel and click Startup. - Verify that the service account is correct. - Retype the password and password confirmation. - Go to User Manager for Domains. - Click on Policies from the title bar menu, and select User Rights. - Select the option for Advanced User Rights. - In the drop-down list, verify that the following rights have been - granted to the service account: - Act as part of the operating system - Back up files and directories - Log on as a service - Restore files and directories -- -
Multiple instances of Apache can be installed and run as services. Signal + an installed Apache service to start, restart, or shutdown/stop + as follows:
apache -n "service name" -k start @@ -206,69 +250,69 @@ Signal an Apache service to start, restart, or shutdown/stop as follows: apache -n "service name" -k stop-(Note; shutdown and stop are identical actions). -In addition, you can use the native NT NET command to -start and stop Apache services as follows: +
For the default "Apache" service, the -n Apache option is still required, + since the -k commands without the -n option are directed at Apache running + in a console window. The quotes are only required if the service name + contains spaces.
+ +Note: the -k stop alias for the -k shutdown command was introduced + in Apache version 1.3.13. Earlier versions of Apache will only + recognize the -k shutdown option. Prior to 1.3.3, Apache did not recognize + any -k options at all!
+ +In addition, you can use the native NT NET command to + start and stop Apache services as follows:
NET START "service name" NET STOP "service name"+
Again, quotes are only required if the service name contains spaces.
Once you have confirmed that Apache runs correctly at the - Command Prompt you can install it as a - service with the command; -
- -- apache -i -+
Note: The service options for Windows 95 and 98 are only available + with Apache 1.3.13 and later. Earlier versions of Apache only + supported Apache in a console window for Windows 95/98.
-You can run Apache as a Windows 95/98 service as follows: -
+There is some support for Apache on Windows 95/98 to behave in a similar + manner as a service on Windows NT/2000. It is highly experimental, + if it works (at all) the Apache Sofware Foundation will not attest to it's + reliability or future support. Proceed at your own risk!
-- apache -k runservice -+
Once you have confirmed that Apache runs correctly at the + Command Prompt you can install, control + and uninstall it with the same commands as the Windows NT/2000 version.
-Apache will attempt to start and if successful it will run in the background. - If you ran this command via a shortcut on your desktop, for example, then if the service starts - successfully a console window may flash up but will immediately disappear. - If Apache detects any errors on startup such as a incorrect entries in the - httpd.conf file then a console window will be left visible. This will display - an error message which will be useful in tracking down the cause of the problem. -
+There are, however, significant differences that you should note:
-You can signal the Apache service to start, restart or shutdown/stop as follows: -
+Apache will attempt to start and if successful it will run in the + background. If you run the command
- apache -k start - apache -k restart - apache -k shutdown - apache -k stop + Apache -n "service name" -k start-(Note; shutdown and stop are identical actions). - -
Windows 95/98 does not support NET START or NET STOP commands so - you must use the above commands at a command prompt. You may wish to set up a shortcut - for each of these commands so that you can just click on it to perform the required action. -
- -You can uninstall the Apache service as follows: -
-- apache -u -+ via a shortcut on your desktop, for example, then if the service starts + successfully a console window will flash up but immediately disappears. + If Apache detects any errors on startup such as a incorrect entries in the + httpd.conf file, then the console window will remain visible. This will + display an error message which will be useful in tracking down the cause of + the problem. + +
Windows 95/98 does not support NET START or NET STOP commands so you must + use Apache's Service Control options at a command prompt. You may wish to + set up a shortcut for each of these commands so that you can just choose + it from the start menu or desktop to perform the required action.
+ +Apache and Windows 95/98 offer no support for running the Apache service + as a specific user with network privilages. In fact, Windows 95/98 offers + no security on the local machine, either. This is the simple reason that + the Apache Software Foundation never endorses the use of Windows 95/98 as a + public httpd server. These facilities exist only to assist the user in + developing web content and learning the Apache server, and perhaps as a + intranet server on a secured, private network.
-- 2.40.0