📄 windows.html.en
字号:
never endorses use of a Windows 9x -based system as a public Apache server. The primitive support for Windows 9x exists only to assist the user in developing web content and learning the Apache server, and perhaps as an intranet server on a secured, private network.</p></li> </ul> <p>Once you have confirmed that Apache runs correctly as a console application you can install, control and uninstall the pseudo-service with the same commands as on Windows NT. You can also use the Apache Service Monitor to manage Windows 9x pseudo-services.</p> </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="wincons" id="wincons">Running Apache as a Console Application</a></h2> <p>Running Apache as a service is usually the recommended way to use it, but it is sometimes easier to work from the command line (on Windows 9x running Apache from the command line is the recommended way due to the lack of reliable service support.)</p> <p>To run Apache from the command line as a console application, use the following command:</p> <div class="example"><p><code> httpd </code></p></div> <p>Apache will execute, and will remain running until it is stopped by pressing Control-C.</p> <p>You can also run Apache via the shortcut Start Apache in Console placed to <code>Start Menu --> Programs --> Apache HTTP Server 2.0.xx --> Control Apache Server</code> during the installation. This will open a console window and start Apache inside it. If you don't have Apache installed as a service, the window will remain visible until you stop Apache by pressing Control-C in the console window where Apache is running in. The server will exit in a few seconds. However, if you do have Apache installed as a service, the shortcut starts the service. If the Apache service is running already, the shortcut doesn't do anything.</p> <p>You can tell a running Apache to stop by opening another console window and entering:</p> <div class="example"><p><code> httpd -k shutdown </code></p></div> <p>This should be preferred over pressing Control-C because this lets Apache end any current operations and clean up gracefully.</p> <p>You can also tell Apache to restart. This forces it to reread the configuration file. Any operations in progress are allowed to complete without interruption. To restart Apache, use:</p> <div class="example"><p><code> httpd -k restart </code></p></div> <div class="note">Note for people familiar with the Unix version of Apache: these commands provide a Windows equivalent to <code>kill -TERM <em>pid</em></code> and <code>kill -USR1 <em>pid</em></code>. The command line option used, <code>-k</code>, was chosen as a reminder of the <code>kill</code> command used on Unix.</div> <p>If the Apache console window closes immediately or unexpectedly after startup, open the Command Prompt from the Start Menu --> Programs. Change to the folder to which you installed Apache, type the command <code>apache</code>, and read the error message. Then change to the logs folder, and review the <code>error.log</code> file for configuration mistakes. If you accepted the defaults when you installed Apache, the commands would be:</p> <div class="example"><p><code> c: <br /> cd "\Program Files\Apache Group\Apache2\bin" <br /> httpd </code></p></div> <p>Then wait for Apache to stop, or press Control-C. Then enter the following:</p> <div class="example"><p><code> cd ..\logs <br /> more < error.log </code></p></div> <p>When working with Apache it is important to know how it will find the configuration file. You can specify a configuration file on the command line in two ways:</p> <ul> <li><p><code>-f</code> specifies an absolute or relative path to a particular configuration file:</p> <div class="example"><p><code> httpd -f "c:\my server files\anotherconfig.conf" </code></p></div> <p>or</p> <div class="example"><p><code> httpd -f files\anotherconfig.conf </code></p></div></li> <li><p><code>-n</code> specifies the installed Apache service whose configuration file is to be used:</p> <div class="example"><p><code> httpd -n "MyServiceName" </code></p></div> </li> </ul> <p>In both of these cases, the proper <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code> should be set in the configuration file.</p> <p>If you don't specify a configuration file with <code>-f</code> or <code>-n</code>, Apache will use the file name compiled into the server, such as <code>conf\httpd.conf</code>. This built-in path is relative to the installation directory. You can verify the compiled file name from a value labelled as <code>SERVER_CONFIG_FILE</code> when invoking Apache with the <code>-V</code> switch, like this:</p> <div class="example"><p><code> httpd -V </code></p></div> <p>Apache will then try to determine its <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code> by trying the following, in this order:</p> <ol> <li>A <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code> directive via the <code>-C</code> command line switch.</li> <li>The <code>-d</code> switch on the command line.</li> <li>Current working directory.</li> <li>A registry entry which was created if you did a binary installation.</li> <li>The server root compiled into the server. This is <code> /apache</code> by default, you can verify it by using <code> apache -V</code> and looking for a value labelled as <code>HTTPD_ROOT</code>.</li> </ol> <p>During the installation, a version-specific registry key is created in the Windows registry. The location of this key depends on the type of the installation. If you chose to install Apache for all users, the key is located under the <code>HKEY_LOCAL_MACHINE</code> hive, like this (the version numbers will of course vary between different versions of Apache: </p> <div class="example"><p><code> HKEY_LOCAL_MACHINE\SOFTWARE\Apache Group\Apache\2.0.43 </code></p></div> <p>Correspondingly, if you chose to install Apache for the current user only, the key is located under the <code>HKEY_CURRENT_USER</code> hive, the contents of which are dependent of the user currently logged on:</p> <div class="example"><p><code> HKEY_CURRENT_USER\SOFTWARE\Apache Group\Apache\2.0.43 </code></p></div> <p>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 in the same directory as another version.</p> <p>If you did not do a binary install, Apache will in some scenarios complain about the missing registry key. This warning can be ignored if the server was otherwise able to find its configuration file.</p> <p>The value of this key is the <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code> directory which contains the <code>conf</code> subdirectory. When Apache starts it reads the <code>httpd.conf</code> file from that directory. If this file contains a <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code> directive which contains a different directory from the one obtained from the registry key above, Apache will forget the registry key and use the directory from the configuration file. If you copy the Apache directory or configuration files to a new location it is vital that you update the <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code> directive in the <code>httpd.conf</code> file to reflect the new location.</p> </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="test" id="test">Testing the Installation</a></h2> <p>After starting Apache (either in a console window or as a service) it will be listening on port 80 (unless you changed the <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> directive in the configuration files or installed Apache only for the current user). To connect to the server and access the default page, launch a browser and enter this URL:</p> <div class="example"><p><code> http://localhost/ </code></p></div> <p>Apache should respond with a welcome page and a link to the Apache manual. If nothing happens or you get an error, look in the <code>error.log</code> file in the <code>logs</code> subdirectory. If your host is not connected to the net, or if you have serious problems with your DNS (Domain Name Service) configuration, you may have to use this URL:</p> <div class="example"><p><code> http://127.0.0.1/ </code></p></div> <p>If you happen to be running Apache on an alternate port, you need to explicitly put that in the URL:</p> <div class="example"><p><code> http://127.0.0.1:8080/ </code></p></div> <p>Once your basic installation is working, you should configure it properly by editing the files in the <code>conf</code> subdirectory. Again, if you change the configuration of the Windows NT service for Apache, first attempt to start it from the command line to make sure that the service starts with no errors.</p> <p>Because Apache <strong>cannot</strong> share the same port with another TCP/IP application, you may need to stop, uninstall or reconfigure certain other services before running Apache. These conflicting services include other WWW servers and some firewall implementations. </p> </div></div><div class="bottomlang"><p><span>Available Languages: </span><a href="../en/platform/windows.html" title="English"> en </a> |<a href="../ko/platform/windows.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p></div><div id="footer"><p class="apache">Copyright 2007 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><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></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -