Nginx - Core Module Directives
The following is the list of directives made available by the Core module. Most of these directives must be placed at the root of the configuration file and can only be used once. However, some of them are valid in multiple contexts. If that is the case, the following is the list of valid contexts under the directive name:
daemon
Enables or disables daemon mode. If you disable it, the program will not be started in the background; it will stay in the foreground
when launched from the shell. This may come in handy for debugging, in situations where you need to know what causes Nginx to crash, and when.
Accepted values: on or off
Example: daemon on;
Default value: on
debug_points
Activates debug points in Nginx. Use stop to interrupt the application when a debug point comes about in order to attach a
debugger. Use abort to abort the debug point and create a core dump file.
To disable this option, simply do not use the directive.
Accepted values: stop or abort
Example: debug_points stop;
Default value: None
env
Lets you (re)define environment variables.
Syntax: env MY_VARIABLE;
Syntax: env MY_VARIABLE=my_value;
error_log
Where level is one of the following values: debug, info, notice, warn, error, and crit (from most to least detailed: debug provides frequent log entries, crit only reports critical errors).
Enables error logging at different levels: Application, HTTP server, virtual host, and virtual host directory.
By redirecting the log output to /dev/null, you can disable error logging. Use the following directive at the root of the configuration file: error_log /dev/null crit;
Context: main, http, server, and location
Syntax: File path
Example: error_log /file/path level;
Default value: logs/error.log error
lock_file
Use a lock file for mutual exclusion. This is disabled by default, unless you enabled it at compile time. On most operating systems the locks are implemented using atomic operations, so this directive is ignored anyway.
Syntax: File path
Example: lock_file logs/nginx.lock;
Default value: Defined at compile time
log_not_found
Enables or disables logging of 404 not found HTTP errors. If your logs get filled with 404 errors due to missing favicon.ico or robots.txt files, you might want to turn this off.
Context: main, http, server, and location
Accepted values: on or off
Syntax: log_not_found on;
Default value: on
master_process
If enabled, Nginx will start multiple processes: a main process (the master process) and worker processes. If disabled, Nginx works with a unique process. This directive should be used for testing purposes only as it disables the master process—clients thus cannot connect to your server.
Accepted values: on or off
Example: master_process on;
Default value: on
pcre_jit
Enables or disables Just-In-Time compilation for regular expressions (PCRE from version 8.20 and above) which may speed up their processing significantly. For this to work, the PCRE libraries on your system must be specifically built with the --enable-jit configuration argument. When configuring your Nginx build, you must also add the --with-pcre-jit argument.
Accepted values: on or off
Example: pcre_jit on;
pid
Path of the pid file for the Nginx daemon. The default value can be configured at compile time. Make sure to enable this directive and set its value properly, since the pid file may be used by the Nginx init script depending on your operating system.
Syntax: File path
Example: pid logs/nginx.pid;
Default value: Defined at compile time.
ssl_engine
Where enginename is the name of an available hardware SSL accelerator on your system. To check for available hardware SSL accelerators, run this command from the shell: openssl engine –t
Syntax: ssl_engine enginename;
Default value: None
thread_stack_size
Defines the size of the thread stack; please refer to the worker_threads directive below.
Syntax: Numeric (size)
Example: thread_stack_size 1m;
Default value: None
timer_resolution
Controls the interval between system calls to gettimeofday() to synchronize the internal clock. If this value is not specified, the clock is refreshed after each kernel event notification.
Syntax: Numeric (time)
Example: timer_resolution 100ms;
Default value: None
user
Lets you define the user account, and optionally the user group used for starting the Nginx worker processes. For security reasons, you should make sure to specify a user and group with limited privileges. For example, create a new user and group dedicated to Nginx, and remember to apply proper permissions on the files that will be served.
Syntax: user username groupname;
Syntax: user username;
Default value: Defined at compile time. If still undefined, the user and group of the Nginx master process are used.
worker_threads
Defines the amount of threads per worker process. Warning! Threads are disabled by default. The author stated that "the code is currently broken."
Syntax: Syntax: Numeric
Example: worker_threads 8;
Default value: None
worker_cpu_affinity
This directive works in conjunction with worker_processes. It lets you affect worker processes to CPU cores.
There are as many series of digit blocks as worker processes; there are as many digits in a block as your CPU has cores.
If you configure Nginx to use three worker processes, there are three blocks of digits. For a dual-core CPU, each block has two
digits: worker_cpu_affinity 01 01 10;
The first block (01) indicates that the first worker process should be affected to the second core.
The second block (01) indicates that the second worker process should be affected to the second core.
The third block (10) indicates that the third worker process should be affected to the first core.
Note that affinity is only recommended for multi-core CPUs, not for processors with hyper-treading or similar technologies.
Example: worker_cpu_affinity 1000 0100 0010 0001;
Example: worker_cpu_affinity 10 10 01 01;
Example: worker_cpu_affinity;
Default value: None
worker_priority
(lowest). The default value is 0. Note that kernel processes run at priority level -5, so it's not recommended that you set the priority to -5 or less.
Syntax: Numeric
Example: worker_priority 0;
Default value: 0
worker_processes
, but it's recommended to increase this value if your CPU has more than one core. Besides, if a process gets blocked due to slow I/O operations, incoming requests can be delegated to the other worker processes.
Alternatively, you may use the auto value which will let Nginx select an appropriate value for this directive. By default, it is the amount of CPU cores detected on the system.
Syntax: Numeric, or auto
Example: worker_processes 4;
Default value: 1
worker_rlimit_core
Defines the size of core files per worker process.
Syntax: Numeric (size)
Example: worker_rlimit_core 100m;
Default value: None
worker_rlimit_nofile
Defines the amount of files a worker process may use simultaneously.
Syntax: Numeric
Example: worker_rlimit_nofile 10000;
Default value: None
worker_rlimit_sigpending
Defines the amount of signals that can be queued per user (user ID of the calling process). If the queue is full, signals are ignored past this limit.
Syntax: Numeric
Example: worker_rlimit_sigpending 10000;
Default value: None
working_directory
Working directory used for worker processes, it is only used to define the location of core files. The worker process user account (user directive) must have write permissions on this folder in order to be able to write core files.
Syntax: Directory path
Example: working_directory /usr/local/nginx/;
Default value: The prefix switch defined at compile time.
worker_aio_requests
If you are using aio with the epoll connection processing method, this directive sets the maximum number of outstanding synchronous I/O operations for a single worker process.
Syntax: Numeric
Example: worker_aio_requests 10000;
Nginx - Core Module Directives的更多相关文章
- Nginx - Rewrite Module
Initially, the purpose of this module (as the name suggests) is to perform URL rewriting. This mecha ...
- Nginx - SSI Module
SSI, for Server Side Includes, is actually a sort of server-side programming language interpreted by ...
- How to Customize Server Header using NginX headers-more module
http://wiki.nginx.org/HttpHeadersMoreModule#Version headers_more When you are browsing a website, yo ...
- nginx上传模块—nginx upload module-
一. nginx upload module原理 官方文档: http://www.grid.net.ru/nginx/upload.en.html Nginx upload module通过ngin ...
- nginx upload module的使用
现在的网站,总会有一点与用户交互的功能,例如允许用户上传头像,上传照片,上传附件这类的.PHP写的程序,对于上传文件效率不是很高.幸好,nginx有一个名为upload的module可以解决这个问题. ...
- Nginx Upload Module 上传模块
传统站点在处理文件上传请求时,普遍使用后端编程语言处理,如:Java.PHP.Python.Ruby等.今天给大家介绍Nginx的一个模块,Upload Module上传模块,此模块的原理是先把用户上 ...
- Nginx Image Module图片缩略图 水印处理模块
Nginx Image Module图片缩略图 水印处理模块 下载Tengine tar -zxvf tengine-1.4.5.tar.gz cd tengine-1.4.5 下载Nginx tar ...
- .NET Core开发日志——从ASP.NET Core Module到KestrelServer
ASP.NET Core程序现在变得如同控制台(Console)程序一般,同样通过Main方法启动整个应用.而Main方法要做的事情很简单,创建一个WebHostBuilder类,调用其Build方法 ...
- ASP.NET Core Module overview模块概述
原文地址:ASP.NET Core Module overview By Tom Dykstra, Rick Strahl, and Chris Ross ASP.NET Core模块(ANCM)让你 ...
随机推荐
- HDU 4461 The Power of Xiangqi (水题)
题意:给定一些字母,每个字母都代表一值,如果字母中没有B,或者C,那么就在总值大于1的条件下删除1,然后比较大小. 析:没什么好说的,加起来比较就好了. 代码如下: #pragma comment(l ...
- 【PYTHON】二维码生成
二维码是什么? 二维码从一维码扩展而来,增加另一维具有可读性的条码,用黑白矩形图形表示二进制数据,被设备扫描后获取其中包含的信息,二维码的长度.宽度均记载着数据,二维码具有定位点和容错机制,即便没有辨 ...
- 关于Vim的问题s
2013-11-23 17:29:45 1.关于.swp文件 swap对于保护非正常退出是有好处的,但从最开始使用vim就发现的一个问题十分恼火!非正常退出再进入后选择了恢复R,然后编辑正常保存正常退 ...
- const 成员方法
1.使用场景 代码提供者告诉客户(代码使用者),这个方法不会修改对象的内容,请客户放心使用. 2.代码提供者,尝试在const成员方法中修改对象内容,编译报错.在成员方法中,this是const 指针 ...
- phpStudy 2014的Apache虚拟主机配置
安装phpStudy直接百度下载,傻瓜式安装很简单,一直点击下一步即可,中途根据个人爱好设置WWW目录,我的设置在D盘根目录里. 打开虚拟主机配置,打开D:\phpStudy\Apache\conf下 ...
- TC SRM 665 DIV2 B LuckyCycle 暴力
LuckyCycleTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.ac ...
- uva216 c++回溯法
因为题目要求最多8台电脑,所以可以枚举全排列,然后依次计算距离进行比较,枚举量8!=40320并不大,但这种方法不如回溯法好,当数据再大一些枚举就显得笨拙了,所以这个题我用回溯法做的,回溯有一个好处是 ...
- 分享php中四种webservice实现的简单架构方法及实例(转)
本人所了解的webservice有以下几种:PHP本身的SOAP,开源的NUSOAP,商业版的PHPRPC,以及使用二进制传输数据流的 HessianPHP,那么一下就简单的介绍下这几种webserv ...
- PHP实现Web Service(转)
1.OAuth OAUTH协议为用户资源的授权提供了一个安全的.开放而又简易的标准.与以往的授权方式不同之处是OAUTH的授权不会使第三方触及到用户的帐号信息(如用户名与密码) 2.SCA 服务组件 ...
- android141 360 安装软件管理
主界面: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/andro ...