]> granicus.if.org Git - apache/blob - docs/manual/platform/windows.html.en
64b36bcfd94e7d38cd986f7cb2c9d83beecdaf32
[apache] / docs / manual / platform / windows.html.en
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5               This file is generated from xml source: DO NOT EDIT
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7       -->
8 <title>Using Apache with Microsoft Windows - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
13 <body id="manual-page"><div id="page-header">
14 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
15 <p class="apache">Apache HTTP Server Version 2.1</p>
16 <img alt="" src="../images/feather.gif" /></div>
17 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
18 <div id="path">
19 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs-project/">Documentation</a> &gt; <a href="../">Version 2.1</a> &gt; <a href="./">Platform Specific Notes</a></div><div id="page-content"><div id="preamble"><h1>Using Apache with Microsoft Windows</h1>
20 <div class="toplang">
21 <p><span>Available Languages: </span><a href="../en/platform/windows.html" title="English">&nbsp;en&nbsp;</a></p>
22 </div>
23
24
25     <p>This document explains how to install, configure and run
26     Apache 2.0 under Microsoft Windows. If you find any bugs, or
27     wish to contribute in other ways, please use our <a href="http://httpd.apache.org/bug_report.html">bug reporting
28     page</a>.</p>
29
30     <p>This document assumes that you are installing a binary
31     distribution of Apache. If you want to compile Apache yourself
32     (possibly to help with development or tracking down bugs),
33     see <a href="win_compiling.html">Compiling Apache for Microsoft
34     Windows</a>.</p>
35
36     <p><strong>Because of the current versioning policies on Microsoft
37     Windows operating system families, this document assumes the
38     following:</strong></p>
39     <ul>
40       <li><strong>Windows NT:</strong> This means all versions of
41       Windows that are based on the Windows NT kernel. Includes Windows
42       NT, Windows 2000, Windows XP and Windows .Net Server 2003.</li>
43       <li><strong>Windows 9x:</strong> This means older,
44       consumer-oriented versions of Windows. Includes Windows 95 (also
45       OSR2), Windows 98 and Windows ME.</li>
46     </ul>
47
48   </div>
49 <div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#req">Operating System Requirements</a></li>
50 <li><img alt="" src="../images/down.gif" /> <a href="#down">Downloading Apache for Windows</a></li>
51 <li><img alt="" src="../images/down.gif" /> <a href="#inst">Installing Apache for Windows</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#cust">Customizing Apache for Windows</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#winsvc">Running Apache as a Service</a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#wincons">Running Apache as a Console Application</a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#test">Testing the Installation</a></li>
56 </ul></div>
57 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
58 <div class="section">
59 <h2><a name="req" id="req">Operating System Requirements</a></h2>
60     
61
62     <p>The primary Windows platform for running Apache 2.0 is Windows
63     NT. The binary installer only works with the x86 family of
64     processors, such as Intel and AMD processors. Running Apache on
65     Windows 9x is not thoroughly tested, and it is never recommended on
66     production systems.
67     </p>
68
69     <p>On all operating systems, TCP/IP networking must be installed
70     and working. If running on Windows 95, the Winsock 2 upgrade must
71     be installed. Winsock 2 for Windows 95 can be downloaded from <a href="http://www.microsoft.com/windows95/downloads/contents/WUAdminTools/S_WUNetworkingTools/W95Sockets2/Default.asp">here</a>.
72     </p>
73
74     <p>On Windows NT 4.0, installing Service Pack 6 is strongly
75     recommended, as Service Pack 4 created known issues with TCP/IP
76     and Winsock integrity that were resolved in later Service Packs.</p>
77   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
78 <div class="section">
79 <h2><a name="down" id="down">Downloading Apache for Windows</a></h2>
80     
81
82     <p>Information on the latest versions of Apache can be found on the
83     web site of the Apache web server at
84     <a href="http://httpd.apache.org/download.cgi">http://httpd.apache.org/download.cgi</a>.
85     There you will find the current release, as well as more recent alpha
86     or beta test versions, and a list of HTTP and FTP mirrors from which
87     you can download the Apache web server. Please use a mirror near to
88     you for a fast and reliable download.</p>
89
90     <p>For Windows installations you should download the version of
91     Apache for Windows with the <code>.msi</code> extension. This is a
92     single Microsoft Installer file, which contains a ready-to-run
93     version of Apache. There is a separate <code>.zip</code> file,
94     which contains only the source code. You can compile Apache
95     yourself with the Microsoft Visual C++ (Visual Studio) tools.</p>
96   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
97 <div class="section">
98 <h2><a name="inst" id="inst">Installing Apache for Windows</a></h2>
99     
100
101     <p>You need Microsoft Installer 1.2 or above for the installation
102     to work. On Windows 9x you can update your Microsoft Installer to
103     version 2.0 <a href="http://www.microsoft.com/downloads/release.asp?ReleaseID=32831">here</a>
104     and on Windows NT 4.0 and 2000 the version 2.0 update can be found
105     <a href="http://www.microsoft.com/downloads/release.asp?ReleaseID=32832">here</a>.
106     Windows XP does not need this update.</p>
107
108     <p>Note that you cannot install two versions of Apache 2.0 on the
109     same computer with the binary installer. You can, however, install
110     a version of the 1.3 series <strong>and</strong> a version of the
111     2.0 series on the same computer without problems. If you need to
112     have two different 2.0 versions on the same computer, you have to
113     <a href="win_compiling.html">compile and install Apache from the
114     source</a>.</p>
115
116     <p>Run the Apache <code>.msi</code> file you downloaded above. The
117     installation will ask you for these things:</p>
118
119     <ol>
120       <li><p><strong>Network Domain.</strong> Enter the DNS domain in which
121       your server is or will be registered in. For example, if your
122       server's full DNS name is <code>server.mydomain.net</code>, you would
123       type <code>mydomain.net</code> here.</p></li>
124
125       <li><p><strong>Server Name.</strong> Your server's full DNS name.
126       From the example above, you would type <code>server.mydomain.net</code>
127       here.</p></li>
128
129       <li><p><strong>Administrator's Email Address.</strong> Enter the
130       server administrator's or webmaster's email address here. This
131       address will be displayed along with error messages to the client
132       by default.</p></li>
133
134       <li><p><strong>For whom to install Apache</strong> Select <code>for
135       All Users, on Port 80, as a Service - Recommended</code> if you'd
136       like your new Apache to listen at port 80 for incoming traffic.
137       It will run as a service (that is, Apache will run even if no one
138       is logged in on the server at the moment) Select <code>only for
139       the Current User, on Port 8080, when started Manually</code> if
140       you'd like to install Apache for your personal experimenting or
141       if you already have another WWW server running on port 80.</p></li>
142
143       <li><p><strong>The installation type.</strong> Select <code>Typical</code>
144       for everything except the source code and libraries for module
145       development. With <code>Custom</code> you can specify what to
146       install. A full install will require about 13 megabytes of free
147       disk space. This does <em>not</em> include the size of your web
148       site(s).</p></li>
149
150       <li><p><strong>Where to install.</strong> The default path is
151       <code>C:\Program Files\Apache Group</code> under which a directory
152       called <code>Apache2</code> will be created by default.</p></li>
153     </ol>
154
155     <p>During the installation, Apache will configure the files in the
156     <code>conf</code> subdirectory to reflect the chosen installation
157     directory. However, if any of the configuration files in this
158     directory already exist, they will not be overwritten. Instead, the
159     new copy of the corresponding file will be left with the extension
160     <code>.default</code>. So, for example, if <code>conf\httpd.conf</code>
161     already exists, it will be renamed as <code>conf\httpd.conf.default</code>.
162     After the installation you should manually check to see what new
163     settings are in the <code>.default</code> file, and if necessary,
164     update your existing configuration file.</p>
165
166     <p>Also, if you already have a file called <code>htdocs\index.html</code>,
167     it will not be overwritten (and no <code>index.html.default</code>
168     will be installed either). This means it should be safe to install
169     Apache over an existing installation, although you would have to
170     stop the existing running server before doing the installation, and
171     then start the new one after the installation is finished.</p>
172
173     <p>After installing Apache, you must edit the configuration files
174     in the <code>conf</code> subdirectory as required. These files
175     will be configured during the installation so that Apache is ready
176     to be run from the directory it was installed into, with the
177     documents server from the subdirectory <code>htdocs</code>. There
178     are lots of other options which you should set before you really
179     start using Apache. However, to get started quickly, the files
180     should work as installed.</p>
181   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
182 <div class="section">
183 <h2><a name="cust" id="cust">Customizing Apache for Windows</a></h2>
184     
185
186     <p>Apache is configured by the files in the <code>conf</code>
187     subdirectory. These are the same files used to configure the Unix
188     version, but there are a few different directives for Apache on
189     Windows. See the <a href="../mod/directives.html">directive index</a>
190     for all the available directives.</p>
191
192     <p>The main differences in Apache for Windows are:</p>
193     <ul>
194       <li><p>Because Apache for Windows is multithreaded, it does not
195       use a separate process for each request, as Apache does on Unix.
196       Instead there are usually only two Apache processes running: a
197       parent process, and a child which handles the requests. Within
198       the child process each request is handled by a separate thread.
199       </p>
200
201       <p>The process management directives are also different:</p>
202
203       <p><code class="directive"><a href="../mod/mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</a></code>:
204       Like the Unix directive, this controls how many requests a single
205       child process will serve before exiting. However, unlike on Unix,
206       a single process serves all the requests at once, not just one.
207       If this is set, it is recommended that a very high number is
208       used. The recommended default, <code>MaxRequestsPerChild 0</code>,
209       causes the child process to never exit.</p>
210
211       <div class="warning"><strong>Warning: The server configuration
212       file is reread when a new child process is started. If you have
213       modified <code>httpd.conf</code>, the new child may not start or
214       you may receive unexpected results.</strong></div>
215
216       <p><code class="directive"><a href="../mod/mpm_common.html#threadsperchild">ThreadsPerChild</a></code>:
217       This directive is new. It tells the server how many threads it
218       should use. This is the maximum number of connections the server
219       can handle at once, so be sure to set this number high enough for
220       your site if you get a lot of hits. The recommended default is
221       <code>ThreadsPerChild 50</code>.</p></li>
222
223       <li><p>The directives that accept filenames as arguments must use
224       Windows filenames instead of Unix ones. However, because Apache
225       uses Unix-style names internally, you must use forward slashes,
226       not backslashes. Drive letters can be used; if omitted, the drive
227       with the Apache executable will be assumed.</p></li>
228
229       <li><p>Apache for Windows contains the ability to load modules at
230       runtime, without recompiling the server. If Apache is compiled
231       normally, it will install a number of optional modules in the
232       <code>\Apache2\modules</code> directory. To activate these or
233       other modules, the new <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>
234       directive must be used. For example, to activate the status
235       module, use the following (in addition to the status-activating
236       directives in <code>access.conf</code>):</p>
237
238       <div class="example"><p><code>
239         LoadModule status_module modules/mod_status.so
240       </code></p></div>
241
242       <p>Information on <a href="../mod/mod_so.html#creating">creating
243       loadable modules</a> is also available.</p></li>
244
245       <li><p>Apache can also load ISAPI (Internet Server Application
246       Programming Interface) extensions (i.e. internet server
247       applications), such as those used by Microsoft IIS and other
248       Windows servers. <a href="../mod/mod_isapi.html">More information
249       is available</a>. Note that Apache <strong>cannot</strong> load
250       ISAPI Filters.</p></li>
251
252       <li><p>When running CGI scripts, the method Apache uses to find
253       the interpreter for the script is configurable using the
254       <code class="directive"><a href="../mod/core.html#scriptinterpretersource">ScriptInterpreterSource</a></code>
255       directive.</p></li>
256
257       <li><p>Since it is often difficult to manage files with names
258       like <code>.htaccess</code> in Windows, you may find it useful to
259       change the name of this per-directory configuration file using
260       the <code class="directive"><a href="../mod/core.html#accessfilename">AccessFilename</a></code>
261       directive.</p></li>
262
263       <li><p>Any errors during Apache startup are logged into the
264       Windows event log when running on Windows NT. This mechanism
265       acts as a backup for those situations where Apache cannot even
266       access the normally used <code>error.log</code> file. You can
267       view the Windows event log by using the Event Viewer application
268       on Windows NT 4.0, and the Event Viewer MMC snap-in on newer
269       versions of Windows.</p>
270
271       <div class="note"><strong>Note that there is no startup error logging on
272       Windows 9x because no Windows event log exists on those operating
273       systems.</strong></div></li>
274     </ul>
275
276   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
277 <div class="section">
278 <h2><a name="winsvc" id="winsvc">Running Apache as a Service</a></h2>
279     
280
281     <p>Apache can be run as a service on Windows NT. There is some
282     highly experimental support for similar behavior on Windows 9x.</p>
283
284     <p>You can install Apache as a service automatically during the
285     installation. If you chose to install for all users, the
286     installation will create an Apache service for you. If you specify
287     to install for yourself only, you can manually register Apache as a
288     service after the installation. You have to be a member of the
289     Administrators group for the service installation to succeed.</p>
290
291     <p>Apache comes with a utility called the Apache Service Monitor.
292     With it you can see and manage the state of all installed Apache
293     services on any machine on your network. To be able to manage an
294     Apache service with the monitor, you have to first install the
295     service (either automatically via the installation or manually).
296     </p>
297
298     <p>You can install Apache as a Windows NT service as follows from
299     the command prompt at the Apache <code>bin</code> subdirectory:</p>
300
301     <div class="example"><p><code>
302       apache -k install
303     </code></p></div>
304
305     <p>If you need to specify the name of the service you want to
306     install, use the following command. You have to do this if you
307     have several different service installations of Apache on your
308     computer.</p>
309
310     <div class="example"><p><code>
311       apache -k install -n "MyServiceName"
312     </code></p></div>
313
314     <p>If you need to have specifically named configuration files for
315     different services, you must use this:</p>
316
317     <div class="example"><p><code>
318       apache -k install -n "MyServiceName" -f "c:\files\my.conf"
319     </code></p></div>
320
321     <p>If you use the first command without any special parameters except
322     <code>-k install</code>, the service will be called <code>Apache2</code>
323     and the configuration will be assumed to be <code>conf\httpd.conf</code>.
324     </p>
325
326     <p>Removing an Apache service is easy. Just use:</p>
327
328     <div class="example"><p><code>
329       apache -k uninstall
330     </code></p></div>
331
332     <p>The specific Apache service to be uninstalled can be specified by using:</p>
333
334     <div class="example"><p><code>
335       apache -k uninstall -n "MyServiceName"
336     </code></p></div>
337
338     <p>Normal starting, restarting and shutting down of an Apache
339     service is usually done via the Apache Service Monitor, by using
340     commands like <code>NET START Apache2</code> and <code>NET STOP
341     Apache2</code> or via normal Windows service management. Before
342     starting Apache as a service by any means, you should test the
343     service's configuration file by using:</p>
344
345     <div class="example"><p><code>
346       apache -n "MyServiceName" -t
347     </code></p></div>
348
349     <p>You can control an Apache service by its command line switches,
350     too. To start an installed Apache service you'll use this:</p>
351
352     <div class="example"><p><code>
353       apache -k start
354     </code></p></div>
355
356     <p>To stop an Apache service via the command line switches, use
357     this:</p>
358
359     <div class="example"><p><code>
360       apache -k stop
361     </code></p></div>
362
363     <p>or</p>
364
365     <div class="example"><p><code>
366       apache -k shutdown
367     </code></p></div>
368
369     <p>You can also restart a running service and force it to reread
370     its configuration file by using:</p>
371
372     <div class="example"><p><code>
373       apache -k restart
374     </code></p></div>
375
376     <p>By default, all Apache services are registered to run as the
377     system user (the <code>LocalSystem</code> account). The
378     <code>LocalSystem</code> account has no privileges to your network
379     via any Windows-secured mechanism, including the file system, named
380     pipes, DCOM, or secure RPC. It has, however, wide privileges locally.
381     </p>
382
383     <div class="warning"><strong>Never grant any network privileges to
384     the <code>LocalSystem</code> account! If you need Apache to be able
385     to access network resources, create a separate account for Apache as
386     noted below.</strong></div>
387
388     <p>You may want to create a separate account for running Apache
389     service(s). Especially, if you have to access network resources
390     via Apache, this is strongly recommended.</p>
391
392     <ol>
393       <li>Create a normal domain user account, and be sure to
394       memorize its password.</li>
395
396       <li>Grant the newly-created user a privilege of <code>Log on
397       as a service</code> and <code>Act as part of the operating
398       system</code>. On Windows NT 4.0 these privileges are granted via
399       User Manager for Domains, but on Windows 2000 and XP you probably
400       want to use Group Policy for propagating these settings. You can
401       also manually set these via the Local Security Policy MMC snap-in.
402       </li>
403
404       <li>Confirm that the created account is a member of the Users
405       group.</li>
406
407       <li>Grant the account read and execute (RX) rights to all document
408       and script folders (<code>htdocs</code> and <code>cgi-bin</code>
409       for example).</li>
410
411       <li>Grant the account change (RWXD) rights to the
412       Apache <code>logs</code> directory.</li>
413
414       <li>Grant the account read and execute (RX) rights to the
415       <code>Apache.exe</code> binary executable.</li>
416     </ol>
417
418     <div class="note">It is usually a good practice to grant the user the Apache
419     service runs as read and execute (RX) access to the whole Apache2
420     directory, except the <code>logs</code> subdirectory, where the
421     user has to have at least change (RWXD) rights.</div>
422
423     <p>If you allow the account to log in as a user and as a service,
424     then you can log on with that account and test that the account has the
425     privileges to execute the scripts, read the web pages, and that
426     you can start Apache in a console window. If this works, and you
427     have followed the steps above, Apache should execute as a service
428     with no problems.</p>
429
430     <div class="note"><strong>Error code 2186</strong> is a good indication that
431     you need to review the "Log On As" configuration for the service,
432     since Apache cannot access a required network resource. Also, pay
433     close attention to the privileges of the user Apache is
434     configured to run as.</div>
435
436     <p>When starting Apache as a service you may encounter an error
437     message from the Windows Service Control Manager. For example,
438     if you try to start Apache by using the Services applet in the
439     Windows Control Panel, you may get the following message:</p>
440
441     <div class="example"><p><code>
442       Could not start the Apache2 service on \\COMPUTER <br />
443       Error 1067; The process terminated unexpectedly.
444     </code></p></div>
445
446     <p>You will get this generic error if there is any problem with
447     starting the Apache service. In order to see what is really causing
448     the problem you should follow the instructions for Running Apache
449     for Windows from the Command Prompt.</p>
450
451     <p>There is some support for Apache on Windows 9x to behave in a
452     similar manner as a service on Windows NT. It is <strong>highly
453     experimental</strong>. It is not of production-class reliability,
454     and its future is not guaranteed. It can be mostly regarded as
455     a risky thing to play with - proceed with caution!</p>
456
457     <p>There are some differences between the two kinds of services
458     you should be aware of:</p>
459
460     <ul>
461       <li><p>Apache will attempt to start and if successful it will run
462       in the background. If you run the command</p>
463
464       <div class="example"><p><code>
465         apache -n "MyServiceName" -k start
466       </code></p></div>
467
468       <p>via a shortcut on your desktop, for example, then if the
469       service starts successfully, a console window will flash up but
470       it immediately disappears. If Apache detects any errors on startup
471       such as incorrect entries in the httpd.conf configuration file,
472       the console window will remain visible. This will display an error
473       message which will be useful in tracking down the cause of the
474       problem.</p></li>
475
476       <li><p>Windows 9x does not support <code>NET START</code> or
477       <code>NET STOP</code> commands. You must control the Apache
478       service on the command prompt via the <code>-k</code> switches.
479       </p></li>
480
481       <li><p>Apache and Windows 9x offer no support for running Apache
482       as a specific user with network privileges. In fact, Windows 9x
483       offers no security on the local machine, either. This is the
484       simple reason because of which the Apache Software Foundation
485       never endorses use of a Windows 9x -based system as a public
486       Apache server. The primitive support for Windows 9x exists only
487       to assist the user in developing web content and learning the
488       Apache server, and perhaps as an intranet server on a secured,
489       private network.</p></li>
490
491     </ul>
492
493     <p>Once you have confirmed that Apache runs correctly as a
494     console application you can install, control and uninstall the
495     pseudo-service with the same commands as on Windows NT. You can
496     also use the Apache Service Monitor to manage Windows 9x
497     pseudo-services.</p>
498
499   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
500 <div class="section">
501 <h2><a name="wincons" id="wincons">Running Apache as a Console Application</a></h2>
502     
503
504     <p>Running Apache as a service is usually the recommended way to
505     use it, but it is sometimes easier to work from the command line
506     (on Windows 9x running Apache from the command line is the
507     recommended way due to the lack of reliable service support.)</p>
508
509     <p>To run Apache from the command line as a console application,
510     use the following command:</p>
511
512     <div class="example"><p><code>
513       apache
514     </code></p></div>
515
516     <p>Apache will execute, and will remain running until it is stopped
517     by pressing Control-C.</p>
518
519     <p>You can also run Apache via the shortcut Start Apache in Console
520     placed to <code>Start Menu --&gt; Programs --&gt; Apache HTTP Server
521     2.0.xx --&gt; Control Apache Server</code> during the installation.
522     This will open a console window and start Apache inside it. If you
523     don't have Apache installed as a service, the window will remain
524     visible until you stop Apache by pressing Control-C in the console
525     window where Apache is running in. The server will exit in a few
526     seconds. However, if you do have Apache installed as a service, the
527     shortcut starts the service. If the Apache service is running
528     already, the shortcut doesn't do anything.</p>
529
530     <p>You can tell a running Apache to stop by opening another console
531     window and entering:</p>
532
533     <div class="example"><p><code>
534       apache -k shutdown
535     </code></p></div>
536
537     <p>This should be preferred over pressing Control-C because this
538     lets Apache end any current operations and clean up gracefully.</p>
539
540     <p>You can also tell Apache to restart. This forces it to reread
541     the configuration file. Any operations in progress are allowed to
542     complete without interruption. To restart Apache, use:</p>
543
544     <div class="example"><p><code>
545       apache -k restart
546     </code></p></div>
547
548     <div class="note">Note for people familiar with the Unix version of Apache:
549     these commands provide a Windows equivalent to <code>kill -TERM
550     <em>pid</em></code> and <code>kill -USR1 <em>pid</em></code>. The
551     command line option used, <code>-k</code>, was chosen as a reminder
552     of the <code>kill</code> command used on Unix.</div>
553
554     <p>If the Apache console window closes immediately or unexpectedly
555     after startup, open the Command Prompt from the Start Menu --&gt;
556     Programs. Change to the folder to which you installed Apache, type
557     the command <code>apache</code>, and read the error message. Then
558     change to the logs folder, and review the <code>error.log</code>
559     file for configuration mistakes. If you accepted the defaults when
560     you installed Apache, the commands would be:</p>
561
562     <div class="example"><p><code>
563       c: <br />
564       cd "\Program Files\Apache Group\Apache2\bin" <br />
565       apache
566     </code></p></div>
567
568     <p>Then wait for Apache to stop, or press Control-C. Then enter the
569     following:</p>
570
571     <div class="example"><p><code>
572       cd ..\logs <br />
573       more &lt; error.log
574     </code></p></div>
575
576     <p>When working with Apache it is important to know how it will
577     find the configuration file. You can specify a configuration file
578     on the command line in two ways:</p>
579
580     <ul>
581       <li><p><code>-f</code> specifies an absolute or relative path to
582       a particular configuration file:</p>
583
584       <div class="example"><p><code>
585         apache -f "c:\my server files\anotherconfig.conf"
586       </code></p></div>
587
588       <p>or</p>
589
590       <div class="example"><p><code>
591         apache -f files\anotherconfig.conf
592       </code></p></div></li>
593
594       <li><p><code>-n</code> specifies the installed Apache service
595       whose configuration file is to be used:</p>
596
597       <div class="example"><p><code>
598         apache -n "MyServiceName"
599       </code></p></div>
600       </li>
601     </ul>
602
603     <p>In both of these cases, the proper
604     <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code> should be set in
605     the configuration file.</p>
606
607     <p>If you don't specify a configuration file with <code>-f</code>
608     or <code>-n</code>, Apache will use the file name compiled into the
609     server, such as <code>conf\httpd.conf</code>. This built-in path
610     is relative to the installation directory. You can verify the compiled
611     file name from a value labelled as <code>SERVER_CONFIG_FILE</code> when
612     invoking Apache with the <code>-V</code> switch, like this:</p>
613
614     <div class="example"><p><code>
615       apache -V
616     </code></p></div>
617
618     <p>Apache will then try to determine its <code class="directive"><a href="../mod/core.html#&#10;    serverroot">
619     ServerRoot</a></code> by trying the following, in this order:</p>
620
621     <ol>
622       <li>A <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code> directive
623       via the <code>-C</code> command line switch.</li>
624
625       <li>The <code>-d</code> switch on the command line.</li>
626
627       <li>Current working directory.</li>
628
629       <li>A registry entry which was created if you did a binary
630       installation.</li>
631
632       <li>The server root compiled into the server. This is <code>
633       /apache</code> by default, you can verify it by using <code>
634       apache -V</code> and looking for a value labelled as
635       <code>HTTPD_ROOT</code>.</li>
636     </ol>
637
638     <p>During the installation, a version-specific registry key is
639     created in the Windows registry. The location of this key depends
640     on the type of the installation. If you chose to install Apache
641     for all users, the key is located under the
642     <code>HKEY_LOCAL_MACHINE</code> hive, like this (the version
643     numbers will of course vary between different versions of Apache:
644     </p>
645
646     <div class="example"><p><code>
647       HKEY_LOCAL_MACHINE\SOFTWARE\Apache Group\Apache\2.0.43
648     </code></p></div>
649
650     <p>Correspondingly, if you chose to install Apache for the current
651     user only, the key is located under the <code>HKEY_CURRENT_USER</code>
652     hive, the contents of which are dependent of the user currently
653     logged on:</p>
654
655     <div class="example"><p><code>
656       HKEY_CURRENT_USER\SOFTWARE\Apache Group\Apache\2.0.43
657     </code></p></div>
658
659     <p>This key is compiled into the server and can enable you to test
660     new versions without affecting the current version. Of course, you
661     must take care not to install the new version in the same
662     directory as another version.</p>
663
664     <p>If you did not do a binary install, Apache will in some
665     scenarios complain about the missing registry key. This warning can
666     be ignored if the server was otherwise able to find its
667     configuration file.</p>
668
669     <p>The value of this key is the
670     <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code> directory which
671     contains the <code>conf</code> subdirectory. When Apache starts it
672     reads the <code>httpd.conf</code> file from that directory. If
673     this file contains a <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>
674     directive which contains a different directory from the one
675     obtained from the registry key above, Apache will forget the
676     registry key and use the directory from the configuration file. If
677     you copy the Apache directory or configuration files to a new
678     location it is vital that you update the
679     <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code> directive in the
680     <code>httpd.conf</code> file to reflect the new location.</p>
681
682   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
683 <div class="section">
684 <h2><a name="test" id="test">Testing the Installation</a></h2>
685     
686
687     <p>After starting Apache (either in a console window or as a
688     service) it will be listening on port 80 (unless you changed the
689     <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> directive in the
690     configuration files or installed Apache only for the current user).
691     To connect to the server and access the default page, launch a
692     browser and enter this URL:</p>
693
694     <div class="example"><p><code>
695       http://localhost/
696     </code></p></div>
697
698     <p>Apache should respond with a welcome page and a link to the
699     Apache manual. If nothing happens or you get an error, look in the
700     <code>error.log</code> file in the <code>logs</code> subdirectory.
701     If your host is not connected to the net, or if you have serious
702     problems with your DNS (Domain Name Service) configuration, you
703     may have to use this URL:</p>
704
705     <div class="example"><p><code>
706       http://127.0.0.1/
707     </code></p></div>
708
709     <p>Once your basic installation is working, you should configure it
710     properly by editing the files in the <code>conf</code> subdirectory.
711     Again, if you change the configuration of the Windows NT service
712     for Apache, first attempt to start it from the command line to
713     make sure that the service starts with no errors.</p>
714
715     <p>Because Apache <strong>cannot</strong> share the same port with
716     another TCP/IP application, you may need to stop, uninstall or reconfigure
717     certain other services before running Apache. These conflicting
718     services include other WWW servers and some firewall implementations.
719     </p>
720
721   </div></div>
722 <div class="bottomlang">
723 <p><span>Available Languages: </span><a href="../en/platform/windows.html" title="English">&nbsp;en&nbsp;</a></p>
724 </div><div id="footer">
725 <p class="apache">Copyright 1999-2004 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
726 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
727 </body></html>