Nginx - Events Module

The Events module comes with directives that allow you to configure network mechanisms. Some of the parameters have an important impact on the application‘s performance.

All of the directives listed in the following table must be placed in the events block, which is located at the root of the configuration file:

user nginx nginx;
master_process on;
worker_processes 4;
events {
	worker_connections 1024;
	use epoll;
}
[...]

These directives cannot be placed elsewhere (if you do so, the configuration test will fail).



accept_mutex

Enables or disables the use of an accept mutex (mutual exclusion) to open listening sockets.

Accepted values: on or off
Example: accept_mutex on;
Default value: on



accept_mutex_delay

Defines the amount of time a worker process should wait before trying to acquire the resource again. This value is not used if the accept_mutex directive is set to off.

Syntax: Numeric (time)
Example: accept_mutex_delay 500ms;
Default value: 500 milliseconds



connections

Replaced by worker_connections. This directive is now deprecated.



debug_connection

Writes detailed logs for clients matching this IP address or address block. The debug information is stored in the file
specified with the error_log directive, enabled with the debug level.
Note: Nginx must be compiled with the --debug switch in order to enable this feature.

Syntax: IP address or CIDR block.
Example: debug_connection 172.63.155.21;
Example: debug_connection 172.63.155.0/24;
Default value: None.



multi_accept

Defines whether or not Nginx should accept all incoming connections at once from the listening queue.

Syntax: on or off
Example: multi_accept off;
Default value: off



use

Selects the event model among the available ones (the ones that you enabled at compile time), though Nginx automatically selects the most appropriate one.
The supported models are:

  • select: The default and standard module, it is used if the OS does not support a more efficient one (it‘s the only available method under Windows). This method is not recommended for servers that expect to be under high load.
  • poll: It is automatically preferred over select, but is not available on all systems.
  • kqueue: An efficient method for FreeBSD 4.1+, OpenBSD 2.9+, NetBSD 2.0, and MacOS X operating systems.
  • epoll: An efficient method for Linux 2.6+ based operating systems.
  • rtsig: Real-time signals, available as of Linux 2.2.19, but unsuited for high-traffic profiles as default system settings only allow 1,024 queued signals.
  • /dev/poll: An efficient method for Solaris 7 11/99+, HP/UX 11.22+, IRIX 6.5.15+, and Tru64 UNIX 5.1A+ operating systems.
  • eventport: An efficient method for Solaris 10, though a security patch is required.

Accepted values: /dev/poll, epoll, eventport, kqueue, rtsig, or select
Example: use kqueue;
Default value: Defined at compile time



worker_connections

Defines the amount of connections that a worker process may treat simultaneously.

Syntax: Numeric
Example: worker_connections 1024;
Default value: None



worker_connections

Defines the amount of connections that a worker process may treat simultaneously.

Syntax: Numeric
Example: worker_connections 1024;
Default value: None



Nginx - Events Module

时间: 2024-10-10 00:18:20

Nginx - Events Module的相关文章

nginx上传模块—nginx upload module-

一. nginx upload module原理 官方文档: http://www.grid.net.ru/nginx/upload.en.html Nginx upload module通过nginx服务来接受用户上传的文件,自动解析请求体中存储的所有文件上传到upload_store指定的目录下.这些文件信息从原始请求体中分离并根据nginx.conf中的配置重新组装好上传参数,交由upload_pass指定的段处理,从而允许处理任意上传文件.每个上传文件中的file字段值被一系列的uplo

Nginx - SSI Module

SSI, for Server Side Includes, is actually a sort of server-side programming language interpreted by Nginx. Its name is based on the fact that the most used functionality of the language is the include command. Back in the 1990s, such languages were

转:使用 Nginx Upload Module 实现上传文件功能

普通网站在实现文件上传功能的时候,一般是使用Python,Java等后端程序实现,比较麻烦.Nginx有一个Upload模块,可以非常简单的实现文件上传功能.此模块的原理是先把用户上传的文件保存到临时文件,然后在交由后台页面处理,并且把文件的原名,上传后的名称,文件类型,文件大小set到页面.下面和大家具体介绍一下. 一.编译安装Nginx 为了使用Nginx Upload Module,需要编译安装Nginx,将upload module编译进去.upload module的代码可以去Gith

Nginx Upload Module 上传模块

传统站点在处理文件上传请求时,普遍使用后端编程语言处理,如:Java.PHP.Python.Ruby等.今天给大家介绍Nginx的一个模块,Upload Module上传模块,此模块的原理是先把用户上传的文件保存到临时文件,然后在交由后台页面处理,并且把文件的原名,上传后的名称,文件类型,文件大小set到页面. GitHub: https://github.com/vkholodkov/nginx-upload-module/tree/2.2 Site: http://wiki.nginx.or

Nginx - Rewrite Module

Initially, the purpose of this module (as the name suggests) is to perform URL rewriting. This mechanism allows you to get rid of ugly URLs containing multiple parameters, for instance, http://example.com/article. php?id=1234&comment=32 — such URLs b

Aliyun OSS Nginx proxy module(阿里云OSS Nginx 签名代理模块)

1.此文章主要介绍内容 本文主要介绍怎样利用Nginx lua 实现将阿里云OSS存储空间做到同本地磁盘一样使用.核心是利用Nginx lua 对OSS请求进行签名并利用内部跳转将全部訪问本地Nginx的请求加上OSS 签名转发给OSS,实现本地Nginx无缝衔接阿里云OSS,存储空间无限扩展,存储成本无限下降,数据安全%99.99-- . 2.本篇文章使用到的一些工具技术及怎样学习和获取 1.lua 本文用到的都是一些主要的lua,基本上花半小时阅读下lua的语法就能够轻松理解本文内容 2.N

Nginx - Core Module Directives

The following is the list of directives made available by the Core module. Most of these directives must be placed at the root of the configuration file and can only be used once. However, some of them are valid in multiple contexts. If that is the c

nginx 之 Module ngx_http_proxy_module 深入研究

# 以下只是自己总结,加深记忆 背景前提介绍: 工作需要,实现对二级nginx反向代理的备份请求:由于国内外网络不稳定原因. 拓扑:主站(北京BGP) 前端nginx,后端tomcat 自制CDN(nginx反向代理) 节点1: HK 香港 节点2:BM 北美 问题:BM nginx反向代理 到 北京BGP,由电信骨干网不稳定,时不时丢包与中断. 解决方案:在广州BGP 增加一个二级nginx反向代理,实现BM nginx反向代理故障,切换备份请求:从而变成了 三级nginx反向代理. 中间碰到

nginx concat module 安装和配置

简介 nginx_concat_module 是淘宝研发的针对 nginx 的文件合并模块,主要用于合并前端代码减少 http 请求数.如果你的应用环境中部署了 nginx,那么可以考虑尝试此模块减少请求数. 安装 安装 nginx_concat_module 需要重新编译 nginx.可以从这里 checkout 最新的代码, svn checkout http://code.taobao.org/svn/nginx_concat_module/trunk/ $NGINX_CONCAT_MOD