原文链接:http://www.nginx.cn/doc/core/mainmodule.html

Nginx主模块

这里是控制 Nginx 的基本功能的指令.

daemon

语法: daemon on | off

缺省值: on



daemon  off;

Do not use the "daemon" and "master\_process" directives in a production mode, these options are mainly used for development only. You can use

daemon off.

safely in production mode with runit / daemontools however you can't do a graceful upgrade.

master\_process off

should never be used in production.

语法:daemon on|off
默认:daemon on
作用:守护进程是可以脱离终端并且在后台运行的进程。他脱离是为了避免进程执行过程中的信息在终端打印出来,这样一来,进程也不会被任何终端所产生的信息打断。默认,就是守护进程开启。
不过,为了调试,所以,可以关闭。

debug\_points

语法:debug\_points [stop|abort]
作用:这个配置用来帮助用户调试Nginx,他接收2个参数:stop和abort。Nginx在一些关键的错误逻辑中设置了调试点。如果设置为stop,那么Nginx的代码执行到这些调试点时,会发出SIGSTOP信号。如果abort,则会产生一个coredump文件。 通常不会用这个配置项。

error\_log

语法: error\_log file [ debug | info | notice | warn | error | crit ]

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

示例 error\_log /xxx/log/nginx/error.log crit;

include

语法: include file | *

缺省值: none

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

include /xxx/server/nginx/conf/vhosts/xxx.conf;

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


include vhosts/*.conf;

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

lock\_file

语法: lock\_file file

缺省值: compile-time option


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、英特尔C++、或SunPro C++编译器在i38、AMD64、SPARC64和PPC64上构建的,那么nginx使用原子指令来实现互斥。在其他情况下,将使用锁文件。

标签: nginx, Nginx, log, file, 文档, include, daemon

相关文章推荐

添加新评论,含*的栏目为必填