Nginx 配置文件
概述
Nginx 服务的基本配置项
#以守护进程 Nginx 运行方式
#语法:daemon off | on;
#默认:daemon on;
#master / worker 工作方式
#语法:master_process on | off;
#默认:master_process on;
#error 日志设置
# 路径 错误级别
#语法:error_log /path/file level;
#默认:error_log logs/error.log error;
#其中/path/file是一个具体文件;level是日志的输出级别,其取值如下:
# debug info notice warn error crit alert emerg
#从左至右级别增大;若设定一个级别后,则在输出的日志文件中只输出级别大于或等于已设定的级别;
#处理特殊调试点
#语法:debug_points [stop | abort]
#这个设置是来跟踪调试 Nginx 的;
#仅对指定的客户端输出 debug 级别的日志
#语法:debug_connection [IP | DIR]
#限制 coredump 核心转储文件的大小
#语法:worker_rlimit_core size;
#指定 coredump 文件的生成目录
#语法:working_directory path;
#定义环境变量
#语法:env VAR | VAR=VALUE;
#VAR 是变量名,VALUE 是目录;
#嵌入其他配置文件
#语法:include /path/file;
#include 配置项可以将其他配置文件嵌入到 Nginx 的 nginx.conf 文件中;
#pid 的文件路径
#语法:pid path/file;
#默认:pid logs/nginx.pid;
#保存 master 进程 ID 的 pid 文件存放路径;
#Nginx worker 运行的用户及用户组
#语法:user username [groupname];
#默认:user nobody nobody;
#指定 Nginx worker进程可打开最大句柄个数
#语法:worker_rlimit_nofile limit;
#限制信号队列
#语法:worker_rlimit_sigpending limit;
#设置每个用户发给 Nginx 的信号队列大小,超出则丢弃;
#Nginx worker 进程的个数
#语法:worker_process number;
#默认:worker_process 1;
#绑定 Nginx worker 进程到指定的 CPU 内核
#语法:worker_cpu_affinity cpumask [cpumask...]
#SSL 硬件加速
#语法:ssl_engine device;
#系统调用 gettimeofday 的执行频率
#语法:timer_resolution t;
#Nginx worker 进程优先级设置
#语法:worker_priority nice;
#默认:worker_priority 0;
#一般有以下几种配置:
#1、是否打开accept锁
# 语法格式:accept_mutex [on | off];
#2、lock文件的路径
# 语法格式:lock_file path/file;
#3、使用accept锁后到真正建立连接之间的延迟时间
# 语法格式:accept_mutex_delay Nms;
#4、批量建立新连接
# 语法格式:multi_accept [on | off];
#
#5、选择事件模型
# 语法格式:use [kqueue | rtisg | epoll | /dev/poll | select | poll | eventport];
#6、每个worker进行的最大连接数
# 语法格式:worker_connections number;
Last updated