view xml/cn/docs/windows.xml @ 1017:9f9a427a73eb

Fixed broken links to chinese versions of some modules. The chinese version contains untranslated copies of english documentation for random_index and realip modules. The result is the appearance of 'translation to chinese' link for this modules pointing to non-existing document. This files are removed. Also, broken links are generated for the chinese version of the "flv" module, but the translation exists, although not enabled for publication. Since contents of file looks like a valid translation, it is allowed to be published.
author Vladimir Homutov <vl@nginx.com>
date Mon, 18 Nov 2013 12:48:10 +0400
parents 9ad2770d3f28
children
line wrap: on
line source

<!--
  Copyright (C) Igor Sysoev
  Copyright (C) Nginx, Inc.
  -->

<!DOCTYPE article SYSTEM "../../../dtd/article.dtd">

<article name="nginx Windows版使用说明"
         link="/cn/docs/windows.html"
         lang="cn"
         rev="1">


<section>

<para>
nginx的Windows版本使用原生Win32 API(非Cygwin模拟层)。当前nginx/Windows只使用<i>select</i>作为通知方法,所以不要期待它有很高的性能和扩展性。鉴于这点和一些已知问题,nginx/Windows目前还处于<i>beta</i>阶段。nginx/Windows和Unix版本相比,功能几乎已经齐全,除了XSLT过滤器、图像过滤器、GeoIP模块和嵌入Perl语言支持以外。
</para>

<para>
安装nginx/Windows,需要<link doc="../download.xml">下载</link>最新的<mainline_version />开发版本,因为开发分支上包含了所有已知的问题修复,尤其是针对Windows版本的问题修复。解压缩下载得到的zip文件,进入nginx-<mainline_version />目录,运行nginx。下面给出一个在C盘根目录下安装的例子:

<programlisting>
cd c:\
unzip nginx-<mainline_version />.zip
cd nginx-<mainline_version />
start nginx
</programlisting>

可以在命令行运行<command>tasklist</command>命令来查看nginx进程:

<programlisting>
C:\nginx-<mainline_version />&gt;tasklist /fi "imagename eq nginx.exe"

Image Name           PID Session Name     Session#    Mem Usage
=============== ======== ============== ========== ============
nginx.exe            652 Console                 0      2 780 K
nginx.exe           1332 Console                 0      3 112 K
</programlisting>

其中一个是主进程,另一个是工作进程。如果nginx没有启动,请查看<path>logs\error.log</path>文件以寻找失败原因。如果日志文件不存在,那失败原因会记录在Windows事件日志中。如果某次请求没有展示预想的页面,而是展示了错误页面,也请查看<path>logs\error.log</path>文件。
</para>

<para>
nginx/Windows使用工作目录作为前缀将配置文件中设置的相对目录补齐。就上面安装的例子而言,工作目录应该是<path>C:\nginx-<mainline_version />\</path>(工作目录基本上与运行文件所在的目录相同)。配置文件中的目录请使用“/”,而不是“\”做目录分隔:

<programlisting>
access_log   logs/site.log;
root         C:/web/html;
</programlisting>
</para>

<para>
nginx/Windows作为标准控制台应用运行,而不是系统服务。可以用下面的命令控制:

<table note="yes">

<tr>
<td width="20%">nginx -s stop</td>
<td>快速退出</td>
</tr>

<tr>
<td>nginx -s quit</td>
<td>优雅退出</td>
</tr>

<tr>
<td>nginx -s reload</td>
<td>
更换配置,启动新的工作进程,优雅的关闭以往的工作进程
</td>
</tr>

<tr>
<td>nginx -s reopen</td>
<td>重新打开日志文件</td>
</tr>

</table>
</para>

</section>

<section id="known_issues"
        name="已知问题">

<list type="bullet">

<listitem>
虽然可以启动若干工作进程运行,实际上只有一个进程在处理请求所有请求。
</listitem>

<listitem>
一个工作进程只能处理不超过1024个并发连接。
</listitem>

<listitem>
缓存和其他需要共享内存支持的模块在Windows Vista及后续版本的操作系统中无法工作,因为在这些操作系统中,地址空间的布局是随机的。
</listitem>

</list>

</section>

<section id="possible_future_enhancements"
        name="日后可能加强的功能">

<list type="bullet">

<listitem>
作为系统服务运行。
</listitem>

<listitem>
使用“I/O完成端口”作为事件模型。
</listitem>

<listitem>
使用单工作进程多线程的模型。
</listitem>

</list>

</section>

</article>