热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

NginxCoreModuleDirectives

ThefollowingisthelistofdirectivesmadeavailablebytheCoremodule.Mostof thesedirectivesmustbe

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: mainhttpserver, 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

Defines the priority of the worker processes, from -20 (highest) to 19 (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

Defines the amount of worker processes. Nginx offers to separate the treatment of requests into multiple processes. The default value is 1, 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


推荐阅读
  • 本文介绍了lua语言中闭包的特性及其在模式匹配、日期处理、编译和模块化等方面的应用。lua中的闭包是严格遵循词法定界的第一类值,函数可以作为变量自由传递,也可以作为参数传递给其他函数。这些特性使得lua语言具有极大的灵活性,为程序开发带来了便利。 ... [详细]
  • HDU 2372 El Dorado(DP)的最长上升子序列长度求解方法
    本文介绍了解决HDU 2372 El Dorado问题的一种动态规划方法,通过循环k的方式求解最长上升子序列的长度。具体实现过程包括初始化dp数组、读取数列、计算最长上升子序列长度等步骤。 ... [详细]
  • 本文讨论了如何优化解决hdu 1003 java题目的动态规划方法,通过分析加法规则和最大和的性质,提出了一种优化的思路。具体方法是,当从1加到n为负时,即sum(1,n)sum(n,s),可以继续加法计算。同时,还考虑了两种特殊情况:都是负数的情况和有0的情况。最后,通过使用Scanner类来获取输入数据。 ... [详细]
  • 本文介绍了C#中数据集DataSet对象的使用及相关方法详解,包括DataSet对象的概述、与数据关系对象的互联、Rows集合和Columns集合的组成,以及DataSet对象常用的方法之一——Merge方法的使用。通过本文的阅读,读者可以了解到DataSet对象在C#中的重要性和使用方法。 ... [详细]
  • 本文介绍了OC学习笔记中的@property和@synthesize,包括属性的定义和合成的使用方法。通过示例代码详细讲解了@property和@synthesize的作用和用法。 ... [详细]
  • 本文介绍了在SpringBoot中集成thymeleaf前端模版的配置步骤,包括在application.properties配置文件中添加thymeleaf的配置信息,引入thymeleaf的jar包,以及创建PageController并添加index方法。 ... [详细]
  • 知识图谱——机器大脑中的知识库
    本文介绍了知识图谱在机器大脑中的应用,以及搜索引擎在知识图谱方面的发展。以谷歌知识图谱为例,说明了知识图谱的智能化特点。通过搜索引擎用户可以获取更加智能化的答案,如搜索关键词"Marie Curie",会得到居里夫人的详细信息以及与之相关的历史人物。知识图谱的出现引起了搜索引擎行业的变革,不仅美国的微软必应,中国的百度、搜狗等搜索引擎公司也纷纷推出了自己的知识图谱。 ... [详细]
  • 本文详细介绍了Linux中进程控制块PCBtask_struct结构体的结构和作用,包括进程状态、进程号、待处理信号、进程地址空间、调度标志、锁深度、基本时间片、调度策略以及内存管理信息等方面的内容。阅读本文可以更加深入地了解Linux进程管理的原理和机制。 ... [详细]
  • 后台获取视图对应的字符串
    1.帮助类后台获取视图对应的字符串publicclassViewHelper{将View输出为字符串(注:不会执行对应的ac ... [详细]
  • 《数据结构》学习笔记3——串匹配算法性能评估
    本文主要讨论串匹配算法的性能评估,包括模式匹配、字符种类数量、算法复杂度等内容。通过借助C++中的头文件和库,可以实现对串的匹配操作。其中蛮力算法的复杂度为O(m*n),通过随机取出长度为m的子串作为模式P,在文本T中进行匹配,统计平均复杂度。对于成功和失败的匹配分别进行测试,分析其平均复杂度。详情请参考相关学习资源。 ... [详细]
  • 本文内容为asp.net微信公众平台开发的目录汇总,包括数据库设计、多层架构框架搭建和入口实现、微信消息封装及反射赋值、关注事件、用户记录、回复文本消息、图文消息、服务搭建(接入)、自定义菜单等。同时提供了示例代码和相关的后台管理功能。内容涵盖了多个方面,适合综合运用。 ... [详细]
  • 本文介绍了使用Java实现大数乘法的分治算法,包括输入数据的处理、普通大数乘法的结果和Karatsuba大数乘法的结果。通过改变long类型可以适应不同范围的大数乘法计算。 ... [详细]
  • 本文讨论了Alink回归预测的不完善问题,指出目前主要针对Python做案例,对其他语言支持不足。同时介绍了pom.xml文件的基本结构和使用方法,以及Maven的相关知识。最后,对Alink回归预测的未来发展提出了期待。 ... [详细]
  • 动态规划算法的基本步骤及最长递增子序列问题详解
    本文详细介绍了动态规划算法的基本步骤,包括划分阶段、选择状态、决策和状态转移方程,并以最长递增子序列问题为例进行了详细解析。动态规划算法的有效性依赖于问题本身所具有的最优子结构性质和子问题重叠性质。通过将子问题的解保存在一个表中,在以后尽可能多地利用这些子问题的解,从而提高算法的效率。 ... [详细]
  • Java验证码——kaptcha的使用配置及样式
    本文介绍了如何使用kaptcha库来实现Java验证码的配置和样式设置,包括pom.xml的依赖配置和web.xml中servlet的配置。 ... [详细]
author-avatar
nancy_liu_tj
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有