TOC

Nginx 连接处理方法

Syntax: use method;
Default: —
Context: events

Specifies the connection processing method to use. There is normally no need to specify it explicitly, because nginx will by default use the most efficient method.

Nginx 默认会自动选择当前平台最高效的方法。

  • epoll Linux 平台上的最佳选择
  • kqueue BSD 家族(包括 MacOS)的最佳选择
  • poll 第一备选
  • select 第二备选
  • eventport Solaris 提供的机制,但是 Nginx 文档上建议使用 /dev/poll
  • /dev/poll

我们接触多的是 Linux 服务器,所以知道是 epoll 就行了。
除非你非常知道自己在做什么,不要调整 use 参数。

以下参数可以控制相关模块的引入:

--with-poll_module
--without-poll_module
--with-select_module
--without-select_module