nginx的一些缺省配置参数可用于调试

一、daemon 
语法: daemon on | off 

缺省值: on 
daemon  off;
生产环境中不要使用"daemon"和"master_process"指令,这些选项仅用于开发调试。 

二、debug_points


语法: debug_points [stop | abort] 

缺省值: none 
debug_points stop;

应该适用于调试,在调试器内设置断点之类的。 

 
三、error_log 

语法: error_log file [ debug | info | notice | warn | error | crit ] 
缺省值: ${prefix}/logs/error.log 
Nginx 添加 --with-debug 编译参数, 你还能够使用以下配置: 
error_log LOGFILE [ debug_core | debug_alloc | debug_mutex | debug_event
]: | debug_http | debug_imap ;

四 include 
语法: include file | * 

缺省值: none 

你可以在任意地方使用include指令实现配置文件的包含,类似于apache中的include方法,可减少主配置文件d。 

include 指令还支持像下面配置一样的全局包含的方法,例如包含一个目录下所有以".conf"结尾的文件: 

include vhosts/*.conf;

注意路径受到configure编译参数--prefix=<路径>指令的影响,如果没有指定,Nginx默认是被编译在/usr/local/nginx。

五、 master_process 
语法: master_process on | off 

缺省值: on 

master_process  off;
生产环境中不要使用"daemon"和"master_process"指令,这些选项仅用于开发调试。 


 
六、pid 
语法: pid file 

缺省值: compile-time option Example: 

pid /var/log/nginx.pid;

进程id存储文件。可以使用 kill -HUP cat /var/log/nginx.pid\ 对Nginx进行配置文件重新加载。


七、ssl_engine
语法: ssl_engine engine 
缺省值: system dependent 

该指令用于指定openssl使用的引擎。你可以通过下面的命令行获知系统目前支持的openssl引擎 

openssl engine -t 

例如: 

$ openssl engine -t
(cryptodev) BSD cryptodev engine
: [ available ] 
(dynamic) Dynamic engine loading support
: [ unavailable ] 


八、timer_resolution 

语法: timer_resolution t 
缺省值: none 
Example: 
timer_resolution  100ms;
The directive allows to decrease number gettimeofday() syscalls. By default gettimeofday() is called after each return from kevent(), epoll, /dev/poll, select(), poll(). 

But if you need an exact time in logs when logging $upstream_response_time, or $msec variables, then you should use timer_resolution. 

九、user 
语法: user user [group] 

缺省值: nobody nobody 

指定Nginx Worker进程运行用户,默认是nobody帐号。 

例如: 

    user www users;
十、worker_cpu_affinity 语法: worker_cpu_affinity cpumask [cpumask...] 

缺省值: none 

仅适用于linux,使用该选项可以绑定worker进程和CPU. 

例如: 

worker_proceses     4;
worker_cpu_affinity 0001 0010 0100 1000;

分别给每个worker进程绑定一个CPU. 

worker_proceses     2;
worker_cpu_affinity 0101 1010;

将CPU0/CPU2绑定给第一个worker进程,将CPU1/CPU3绑定给第二个worker进程。 


十一、worker_priority 

语法: worker_priority [-] number 

缺省值: on 

使用该选项可以给所有的worker进程分配优先值。


十二、worker_processes 

语法: worker_processes number 

缺省值: 1 

e.g.: 

worker_processes 5;

nginx可以使用多个worker进程,原因如下: 

1.to use SMP (对称多处理机)SMP介绍
2.当一个worker在磁盘的读写中(I/O中)可以减少等待时间
3.限制每个进程的连接数 当select()/poll() 被用的时候。
4.The worker_processes and worker_connections from the event sections allows you to 计算最大客户端的值: k 
max_clients = worker_processes * worker_connections 


十三、 worker_rlimit_core 
语法: worker_rlimit_core size 

缺省值: ' 

Maximum size of core file per worker; 


十四、 working_directory 

语法: working_directory path 缺省值: --prefix 

This is the working directory for the workers. It's used for core files only. nginx uses absolute paths only, all relative paths in configuration files are relative to --prefix==PATH. 

原文链接:https://www.linuxidc.com/Linux/2012-04/57908.htm

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值