---
title: "nginx /Windows"
author: "nenty"
date: "2012-07-31T11:58:55Z"
tags: []
categories: ["互联网"]
slug: "nginx-windows"
draft: false
lastmod: "2012-07-31T11:58:55Z"
id: 1613301
url: "https://nenty.iteye.com/blog/1613301"
---

nginx/Windows 使用的是 Win32的 API ，而不是 [Cygwin](http://www.oschina.net/p/cygwin) 模拟的。当前只有 select 这种网络模式，所以你不能指望它拥有高性能和高可扩展性。

要使用 nginx/Windows 建议下载最新的 0.8.32 这个开发版，它解决了很多跟windows版本相关的关键问题，Nginx默认使用C盘作为文档根目录，要改！安装和启动方式如下所示：

cd c:\\  
unzip nginx-0.8.32.zip  
cd nginx-0.8.32  
start nginx

使用 “tasklist” 命令来查看nginx进程

C:\\nginx-0.8.32&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

上面列出两个进程，其中一个是master进程，另外一个是worker进程，如果nginx无法启动，那应该看 logs/error.log 这个日志文件，如果这个文件不存在，那就看windows的事件查看器。

nginx/Windows 中配置指定的目录必须使用unix的斜杠而不是反斜杠的方式，如下所示：

access\_log   logs/site.log;  
root         C:/web/html;

nginx/Windows 是以应用程序方式运行，而不是服务方式，使用下面的命令来启动、停止和重载 Nginx 进程：

nginx -s stop

quick exit

nginx -s quit

graceful quit

nginx -s reload

changing configuration, starting a new worker, quitting gracefully an old worker

nginx -s reopen

reopening log files

[]()**已知的问题**

·          尽管可配置多个worker，但实际上只有一个worker在干活；

·          一个worker最多只能处理1024个并发连接；

·          因为缓存模块需要共享内存支持，因此无法在 Vista 以及以后的系统包括 Windows 7 中运行

**将来可能会改善的地方**

·          支持以服务方式运行

·          Using the I/O completion ports as notification method.

·          使用 worker 线程