accept_mutex

| Syntax: | accept_mutex on | off;

| | —- | —- | | Default: | accept_mutex off; | | Context: | events |

on 避免惊群 , 防止多个进程对连接的争抢

daemon

| Syntax: | daemon on | off;

| | —- | —- | | Default: | daemon on; | | Context: | main |

error_log

| Syntax: | error_log file [level];

| | —- | —- | | Default: | error_log logs/error.log error; | | Context: | main, http, mail, stream, server, location

|

debug, info, notice, warn, error, crit, alert, emerg

events

| Syntax: | events { … }

| | —- | —- | | Default: | — | | Context: | main |

include

| Syntax: | include file | mask;

| | —- | —- | | Default: | — | | Context: | any |

use

| Syntax: | use method;

| | —- | —- | | Default: | — | | Context: | events |

默认由 os 决定
事件驱动模型 select poll epoll kqueue

user

| Syntax: | user user [group];

| | —- | —- | | Default: | user nobody nobody; | | Context: | main |

worker 进程的用户及用户组

pid

| Syntax: | pid file;

| | —- | —- | | Default: | pid logs/nginx.pid; | | Context: | main |

master_process

| Syntax: | master_process on | off;

| | —- | —- | | Default: | master_process on; | | Context: | main |

是否开启 worker 进程

worker_processes

| Syntax: | worker_processes number | auto;

| | —- | —- | | Default: | worker_processes 1; | | Context: | main |

启动的 worker 进程数量

worker_connections

| Syntax: | worker_connections number;

| | —- | —- | | Default: | worker_connections 512; | | Context: | events |

单个 worker 进程最大连接数
不能大于最大文件句柄数

multi_accept

| Syntax: | multi_accept on | off;

| | —- | —- | | Default: | multi_accept off; | | Context: | events |

off worker进程同时只处理一个新的连接