stoddard 99/04/08 14:56:43
Modified: htdocs/manual windows.html Log: Some documentation on the multiple services patch Submitted by: Keith Wannamaker Revision Changes Path 1.28 +95 -30 apache-1.3/htdocs/manual/windows.html Index: windows.html =================================================================== RCS file: /export/home/cvs/apache-1.3/htdocs/manual/windows.html,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- windows.html 1999/03/19 16:07:18 1.27 +++ windows.html 1999/04/08 21:56:40 1.28 @@ -47,7 +47,9 @@ <LI><A HREF="#run">Running Apache for Windows</A> <LI><A HREF="#use">Using Apache for Windows</A> <LI><A HREF="#cmdline">Running Apache for Windows from the Command Line</A> - <LI><A HREF="#signal">Signalling Apache when running</A> + <LI><A HREF="#service">Running Apache for Windows as a Service</A> + <LI><A HREF="#signal">Signalling Console Apache when running</A> + <LI><A HREF="#signalsrv">Signalling Service Apache when running</A> <LI><A HREF="#comp">Compiling Apache for Windows</A> </UL> @@ -145,7 +147,7 @@ There are two ways you can run Apache: <UL> - <LI>As a "service" (available on NT only). This is the best option if + <LI>As a <A HREF="#service">"service"</A> (available on NT only). This is the best option if you want Apache to automatically start when you machine boots, and to keep Apache running when you log-off. @@ -155,12 +157,14 @@ </UL> To start Apache as a service, you first need to install it as a -service. Run the "Install Apache as Service (NT only)" option from the -Start menu. Once this is done you can start Apache by opening the -Services window (in the Control Panel), selecting Apache, then -clicking on Start. Apache will now be running in the background. You +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 Apache from the control +the Services window, you can start and stop the "Apache" service from the control line with <PRE> @@ -168,6 +172,11 @@ NET STOP APACHE </PRE> +See <A HREF="#signalsrv">Signalling Service Apache when Running</A> +for more information on installing and controlling Apache services. + +<P> + To run Apache from a console window, select the "Start Apache as console app" option from the Start menu (in Apache 1.3.4 and earlier, this option was called "Apache Server"). This will open a console @@ -175,7 +184,7 @@ active until you stop Apache. To stop Apache running, either select the "Shutdown Apache console app" icon option from the Start menu (this is not available in Apache 1.3.4 or earlier), or see <A -HREF="#signal">Signalling Apache when Running</A> for how +HREF="#signal">Signalling Console Apache when Running</A> for how to control Apache from the command line. <P> @@ -258,6 +267,44 @@ is available.</A> </UL> +<H2><A NAME="service">Running Apache for Windows as a Service</A></H2> + +You can install Apache as a Windows NT service as follows: + +<PRE> + apache -i -n "service name" +</PRE> + +To install a service to use a particular configuration, specify the +configuration file when the service is installed: + +<PRE> + apache -i -n "service name" -f "\my server\conf\my.conf" +</PRE> + +To remove an Apache service, use + +<PRE> + apache -u -n "service name" +</PRE> + +The default "service name", if one is not specified, is "Apache". + +<P> + +Once a service is installed, you can use the <SAMP>-n</SAMP> option, in conjunction +with other options, to refer to a service's configuration file. For example:<br> + +To test a service's configuration file: +<PRE> + apache -n "service name" -t +</PRE> + +To start a console Apache using a service's configuration file: +<PRE> + apache -n "service name" +</PRE> + <H2><A NAME="cmdline">Running Apache for Windows from the Command Line</A></H2> The Start menu icons and the NT Service manager can provide a simple @@ -266,29 +313,44 @@ <P> When working with Apache it is important to know how it will find the -configuration files. Apache will try one of the following, in this order. +configuration files. You can specify a configuration file on the command line +in two ways: <UL> +<LI>-f specifies a path to a particular configuration file +</UL> +<PRE> apache -f "c:\my server\conf\my.conf"</PRE> +<PRE> apache -f test\test.conf</PRE> +<UL> +<LI>-n specifies the configuration file of an installed Apache service +</UL> +<PRE> apache -n "service name"</PRE> + +In these cases, the proper ServerRoot should be set in the configuration file. + +<P> + +If you don't specify a configuration file name with -f or -n, Apache will +use the file name compiled into the server, usually "conf/httpd.conf". Invoking +Apache with the -V switch will display this value labeled as SERVER_CONFIG_FILE. +Apache will then determine it's ServerRoot by trying the following, in this order: + +<UL> <LI>A ServerRoot directive via a -C switch. -<LI>The -f switch on the command line. <LI>The -d switch on the command line. +<LI>Current working directory <LI>A registry entry, created if you did a binary install. <LI>The server root compiled into the server. </UL> <P> The server root compiled into the server is usually "/apache". -invoking apache with the -v switch will display this value +invoking apache with the -V switch will display this value labeled as HTTPD_ROOT. -<P> -Your current working directory when Apache is started up has no -effect on Apache's behavior. - <P> -When invoked from the start menu or the Service Manager, Apache is -usually passed no arguments, so using the registry entry is the preferred -technique. +When invoked from the start menu, Apache is usually passed no arguments, +so using the registry entry is the preferred technique for console Apache. <P> During a binary installation, a registry key will have @@ -301,8 +363,7 @@ This key is compiled into the server and can enable you to test new versions without affecting the current version. Of course you must take care not to install the new version on top of the -old version in the file system. You cannot run two invocations -of Apache on Windows simultaneously. +old version in the file system. <P> If you did not do a binary install then Apache will in some @@ -326,30 +387,33 @@ following command: <PRE> - apache -s + apache </PRE> Apache will execute, and will remain running until it is stopped by pressing -control-C. (The -s option is not required by Windows 95, but on Windows NT it -prevents Apache waiting to see if Apache is running as a service.) +control-C. -<P> +<H2><A NAME="signalsrv">Signalling Service Apache when running</A></H2> -You can install Apache as a Windows NT service as follows: +On Windows NT, multiple instances of Apache can be run as services. +Signal an Apache service to start, restart, or shutdown as follows: <PRE> - apache -i + apache -n "service name" -k start + apache -n "service name" -k restart + apache -n "service name" -k shutdown </PRE> -and to remove the Apache service, use +In addition, you can use the native NT NET command to +start and stop Apache services as follows: <PRE> - apache -u + NET START "service name" + NET STOP "service name" </PRE> +<H2><A NAME="signal">Signalling Console Apache when running</A></H2> -<H2><A NAME="signal">Signalling Apache when running</A></H2> - On Windows 95, Apache runs as a console application. You can tell a running Apache to stop by opening another console window and running @@ -486,3 +550,4 @@ <!--#include virtual="footer.html" --> </BODY> </HTML> +