3 1 Nginx全域性配置說明

2022-07-11 05:15:11 字數 1840 閱讀 3652

user  nginx nginx;                 # 啟動nginx⼯作程序的⽤⼾和組

worker_processes [number | auto]; # 啟動nginx⼯作程序的數量

worker_cpu_affinity 00000001 00000010 00000100 00001000;

## 將nginx⼯作程序繫結到指定的cpu核⼼,預設nginx是不進⾏程序繫結的,繫結並不是意味著當前nginx程序獨

## 佔以⼀核⼼cpu,但是可以保證此程序不會運⾏在其他核⼼上,這就極⼤減少了nginx的⼯作程序在不同的cpu核

## ⼼上的來回跳轉,減少了cpu對程序的資源分配與**以及記憶體管理等,因此可以有效的提公升nginx伺服器的性

## 能。 此處cpu有四顆核心。也可寫成:

worker_cpu_affinity 0001 0010 0100 1000;

## 錯誤⽇志記錄配置,語法:error_log file [debug | info | notice | warn | error | crit | alert | emerg]

# error_log logs/error.log;

# error_log logs/error.log notice;

# pid⽂件儲存路徑

worker_priority 0; # ⼯作程序nice值,-20~19

worker_rlimit_nofile 65536; # 這個數字包括nginx的所有連線(例如與**伺服器的連線等),⽽不僅僅是與

# 客⼾端的連線,另⼀個考慮因素是實際的併發連線數不能超過系統級別的最⼤開啟⽂件數的限制.

[root@s2 ~]# watch -n1 'ps -axo pid,cmd,nice | grep nginx' #驗證程序優先順序

daemon off; # 前台運⾏nginx服務⽤於測試、docker等環境。

master_process off|on; #是否開啟nginx的master-woker⼯作模式,僅⽤於開發除錯場景。

#error_page 500 502 503 504 /50x.html; # 定義錯誤⻚⾯

nginx 配置說明

定義nginx執行的使用者和使用者組 user www www nginx程序數,建議設定為等於cpu總核心數。worker processes 8 全域性錯誤日誌定義型別,debug info notice warn error crit error log ar loginx error.log...

nginx配置說明

依賴 zlib,pcre,openssl configure prefix usr local nginx with openssl usr include 啟用ssl with pcre usr include pcre 啟用正規表示式 with http stub status module 安...

Nginx配置說明

nginx配置引數中文詳細說明 定義nginx執行的使用者和使用者組 user www www nginx程序數,建議設定為等於cpu總核心數.worker processes 8 全域性錯誤日誌定義型別,debug info notice warn error crit error log var...