📄 windows.html.en
字号:
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX This file is generated from xml source: DO NOT EDIT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --><title>Using Apache with Microsoft Windows - Apache HTTP Server</title><link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /><link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /><link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link href="../images/favicon.ico" rel="shortcut icon" /></head><body id="manual-page"><div id="page-header"><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><p class="apache">Apache HTTP Server Version 2.0</p><img alt="" src="../images/feather.gif" /></div><div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div><div id="path"><a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.0</a> > <a href="./">Platform Specific Notes</a></div><div id="page-content"><div id="preamble"><h1>Using Apache with Microsoft Windows</h1><div class="toplang"><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> <p>This document explains how to install, configure and run Apache 2.0 under Microsoft Windows. If you find any bugs, or wish to contribute in other ways, please use our <a href="http://httpd.apache.org/bug_report.html">bug reporting page</a>.</p> <p>This document assumes that you are installing a binary distribution of Apache. If you want to compile Apache yourself (possibly to help with development or tracking down bugs), see <a href="win_compiling.html">Compiling Apache for Microsoft Windows</a>.</p> <p><strong>Because of the current versioning policies on Microsoft Windows operating system families, this document assumes the following:</strong></p> <ul> <li><strong>Windows NT:</strong> This means all versions of Windows that are based on the Windows NT kernel. Includes Windows NT, Windows 2000, Windows XP and Windows .Net Server 2003.</li> <li><strong>Windows 9x:</strong> This means older, consumer-oriented versions of Windows. Includes Windows 95 (also OSR2), Windows 98 and Windows ME.</li> </ul> </div><div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#req">Operating System Requirements</a></li><li><img alt="" src="../images/down.gif" /> <a href="#down">Downloading Apache for Windows</a></li><li><img alt="" src="../images/down.gif" /> <a href="#inst">Installing Apache for Windows</a></li><li><img alt="" src="../images/down.gif" /> <a href="#cust">Customizing Apache for Windows</a></li><li><img alt="" src="../images/down.gif" /> <a href="#winsvc">Running Apache as a Service</a></li><li><img alt="" src="../images/down.gif" /> <a href="#wincons">Running Apache as a Console Application</a></li><li><img alt="" src="../images/down.gif" /> <a href="#test">Testing the Installation</a></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="req" id="req">Operating System Requirements</a></h2> <p>The primary Windows platform for running Apache 2.0 is Windows NT. The binary installer only works with the x86 family of processors, such as Intel and AMD processors. Running Apache on Windows 9x is not thoroughly tested, and it is never recommended on production systems. </p> <p>On all operating systems, TCP/IP networking must be installed and working. If running on Windows 95, the Winsock 2 upgrade must 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>. </p> <p>On Windows NT 4.0, installing Service Pack 6 is strongly recommended, as Service Pack 4 created known issues with TCP/IP and Winsock integrity that were resolved in later Service Packs.</p> </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="down" id="down">Downloading Apache for Windows</a></h2> <p>Information on the latest versions of Apache can be found on the web site of the Apache web server at <a href="http://httpd.apache.org/download.cgi">http://httpd.apache.org/download.cgi</a>. There you will find the current release, as well as more recent alpha or beta test versions, and a list of HTTP and FTP mirrors from which you can download the Apache web server. Please use a mirror near to you for a fast and reliable download.</p> <p>For Windows installations you should download the version of Apache for Windows with the <code>.msi</code> extension. This is a single Microsoft Installer file, which contains a ready-to-run version of Apache. There is a separate <code>.zip</code> file, which contains only the source code. You can compile Apache yourself with the Microsoft Visual C++ (Visual Studio) tools.</p> </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="inst" id="inst">Installing Apache for Windows</a></h2> <p>You need Microsoft Installer 1.2 or above for the installation to work. On Windows 9x you can update your Microsoft Installer to version 2.0 <a href="http://www.microsoft.com/downloads/release.asp?ReleaseID=32831">here</a> and on Windows NT 4.0 and 2000 the version 2.0 update can be found <a href="http://www.microsoft.com/downloads/release.asp?ReleaseID=32832">here</a>. Windows XP does not need this update.</p> <p>Note that you cannot install two versions of Apache 2.0 on the same computer with the binary installer. You can, however, install a version of the 1.3 series <strong>and</strong> a version of the 2.0 series on the same computer without problems. If you need to have two different 2.0 versions on the same computer, you have to <a href="win_compiling.html">compile and install Apache from the source</a>.</p> <p>Run the Apache <code>.msi</code> file you downloaded above. The installation will ask you for these things:</p> <ol> <li><p><strong>Network Domain.</strong> Enter the DNS domain in which your server is or will be registered in. For example, if your server's full DNS name is <code>server.mydomain.net</code>, you would type <code>mydomain.net</code> here.</p></li> <li><p><strong>Server Name.</strong> Your server's full DNS name. From the example above, you would type <code>server.mydomain.net</code> here.</p></li> <li><p><strong>Administrator's Email Address.</strong> Enter the server administrator's or webmaster's email address here. This address will be displayed along with error messages to the client by default.</p></li> <li><p><strong>For whom to install Apache</strong> Select <code>for All Users, on Port 80, as a Service - Recommended</code> if you'd like your new Apache to listen at port 80 for incoming traffic. It will run as a service (that is, Apache will run even if no one is logged in on the server at the moment) Select <code>only for the Current User, on Port 8080, when started Manually</code> if you'd like to install Apache for your personal experimenting or if you already have another WWW server running on port 80.</p></li> <li><p><strong>The installation type.</strong> Select <code>Typical</code> for everything except the source code and libraries for module development. With <code>Custom</code> you can specify what to install. A full install will require about 13 megabytes of free disk space. This does <em>not</em> include the size of your web site(s).</p></li> <li><p><strong>Where to install.</strong> The default path is <code>C:\Program Files\Apache Group</code> under which a directory called <code>Apache2</code> will be created by default.</p></li> </ol> <p>During the installation, Apache will configure the files in the <code>conf</code> subdirectory to reflect the chosen installation directory. However, if any of the configuration files in this directory already exist, they will not be overwritten. Instead, the new copy of the corresponding file will be left with the extension <code>.default</code>. So, for example, if <code>conf\httpd.conf</code> already exists, it will be renamed as <code>conf\httpd.conf.default</code>. After the installation you should manually check to see what new settings are in the <code>.default</code> file, and if necessary, update your existing configuration file.</p> <p>Also, if you already have a file called <code>htdocs\index.html</code>, it will not be overwritten (and no <code>index.html.default</code> will be installed either). This means it should be safe to install Apache over an existing installation, although you would have to stop the existing running server before doing the installation, and then start the new one after the installation is finished.</p> <p>After installing Apache, you must edit the configuration files in the <code>conf</code> subdirectory as required. These files will be configured during the installation so that Apache is ready to be run from the directory it was installed into, with the documents server from the subdirectory <code>htdocs</code>. There are lots of other options which you should set before you really start using Apache. However, to get started quickly, the files should work as installed.</p> </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="cust" id="cust">Customizing Apache for Windows</a></h2> <p>Apache is configured by the files in the <code>conf</code> subdirectory. These are the same files used to configure the Unix version, but there are a few different directives for Apache on Windows. See the <a href="../mod/directives.html">directive index</a> for all the available directives.</p> <p>The main differences in Apache for Windows are:</p> <ul> <li><p>Because Apache for Windows is multithreaded, it does not use a separate process for each request, as Apache does on Unix. Instead there are usually only two Apache processes running: a parent process, and a child which handles the requests. Within the child process each request is handled by a separate thread. </p> <p>The process management directives are also different:</p> <p><code class="directive"><a href="../mod/mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</a></code>: Like the Unix directive, this controls how many requests a single child process will serve before exiting. However, unlike on Unix, a single process serves all the requests at once, not just one. If this is set, it is recommended that a very high number is used. The recommended default, <code>MaxRequestsPerChild 0</code>, causes the child process to never exit.</p> <div class="warning"><strong>Warning: The server configuration file is reread when a new child process is started. If you have modified <code>httpd.conf</code>, the new child may not start or you may receive unexpected results.</strong></div> <p><code class="directive"><a href="../mod/mpm_common.html#threadsperchild">ThreadsPerChild</a></code>: This directive is new. It tells the server how many threads it should use. This is the maximum number of connections the server can handle at once, so be sure to set this number high enough for your site if you get a lot of hits. The recommended default is <code>ThreadsPerChild 50</code>.</p></li> <li><p>The directives that accept filenames as arguments must use Windows filenames instead of Unix ones. However, because Apache uses Unix-style names internally, you must use forward slashes, not backslashes. Drive letters can be used; if omitted, the drive with the Apache executable will be assumed.</p></li> <li><p>While filenames are generally case-insensitive on Windows, URLs are still treated internally as case-sensitive before they are mapped to the filesystem. For example, the <code class="directive"><a href="../mod/core.html#location"><Location></a></code>, <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code>, and <code class="directive"><a href="../mod/mod_proxy.html#proxypass">ProxyPass</a></code> directives all use case-sensitive arguments. For this reason, it is particularly important to use the <code class="directive"><a href="../mod/core.html#directory"><Directory></a></code> directive when attempting to limit access to content in the filesystem, since this directive applies to any content in a directory, regardless of how it is accessed. If you wish to assure that only lowercase is used in URLs, you can use something like:</p> <div class="example"><p><code> RewriteEngine On<br /> RewriteMap lowercase int:tolower<br /> RewriteCond %{REQUEST_URI} [A-Z]<br /> RewriteRule (.*) ${lowercase:$1} [R,L] </code></p></div></li> <li><p>Apache for Windows contains the ability to load modules at runtime, without recompiling the server. If Apache is compiled normally, it will install a number of optional modules in the <code>\Apache2\modules</code> directory. To activate these or
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -