Nginx基本功能

daemon

daemon on | off

缺省值: on

  1. daemon off;
  2. master_process off

Do not use the “daemon” and “master_process” directives in a production mode, these options are mainly used for development only. safely in production mode with runit / daemontools however you can’t do a graceful upgrade.

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

debug_points

debug_points [stop | abort]

缺省值: none

  1. debug_points stop;

There are some assertion points inside nginx that allow to stop nginx to attach the debugger, or to abort and to create the core file.

应该适用于调试,在调试器内设置断点

error_log

error_log file [ debug | info | notice | warn | error | crit ]

缺省值: ${prefix}/logs/error.log

  1. # 编译参数
  2. nginx --with-debug
  3. error_log LOGFILE [ debug_core | debug_alloc | debug_mutex | debug_event]: | debug_http | debug_imap ;

include

include file | *

缺省值: none

可以任意地方使用include命令配置文件包含、

指令还支持像下面配置一样的全局包含的方法,例如包含/etc/nginx/conf.d下所有以”.conf”结尾的文件:

  1. include /etc/nginx/conf.d/*.conf;

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

lock_file

lock_file file

缺省值: compile-time option

  1. lock_file /var/log/lock_file;

nginx uses accept mutex to serialize accept() syscalls. If nginx is built by gcc, Intel C++, or SunPro C++ compilers on i386, amd64, sparc64, and ppc64, then nginx uses the atomic instructions to implement the mutex. In other cases the lock file would be used.

nginx使用accept互斥来序列化accept()系统调用。如果nginx是由gcc、Intel c或SunPro c编译器在i386、amd64、sparc64和ppc64上编译的,那么nginx使用原子指令来实现互斥锁。在其他情况下,将使用锁文件。

master_process

master_process on | off