nginx配置詳細說明

2021-07-05 08:47:12 字數 1304 閱讀 1736

#定義nginx執行的使用者和使用者組

user www www;  

#nginx程序數,建議設定為等於cpu總核心數。

worker_processes 8;  

#全域性錯誤日誌定義型別,[ debug | info | notice | warn | error | crit ]

error_log /var/log/nginx/error.log info;  

#程序檔案

pid /var/run/nginx.pid;  

#乙個nginx程序開啟的最多檔案描述符數目,理論值應該是最多開啟檔案數(系統的值ulimit -n)與nginx程序數相除,但是nginx分配請求並不均勻,所以建議與ulimit -n的值保持一致。

worker_rlimit_nofile 65535;  

#工作模式與連線數上限

events  

#設定http伺服器

#虛擬主機的配置

server  

#快取時間設定

#js和css快取時間設定

location ~ .*\.(js|css)?$  

#日誌格式設定

#定義本虛擬主機的訪問日誌

access_log /var/log/nginx/ha97access.log access;  

#對 "/" 啟用反向**

location /   

#設定檢視nginx狀態的位址

location /nginxstatus   

#本地動靜分離反向**配置

#所有jsp的頁面均交由tomcat或resin處理

location ~ .(jsp|jspx|do)?$   

#所有靜態檔案由nginx直接讀取不經過tomcat或resin

nginx配置詳細說明

執行使用者 user nobody pid檔案 pid logs nginx.pid worker程序數,通常設定等同於cpu數量,auto為自動檢測 worker processes auto worker程序開啟最大檔案數,可cpu 10000設定 worker rlimit nofile 10...

nginx完全配置詳細說明

nginx完全配置詳細說明 啟動程序,通常設定成和cpu的數量相等 worker processes 1 全域性錯誤日誌及pid檔案 error log var log nginx error.log pid var run nginx.pid 開啟gzip壓縮 gzip on gzip disab...

Nginx 配置檔案詳細說明

配置說明 執行使用者 user nginx nginx 啟動程序,通常設定成何cpu的數量相等 worker processes 4 四核開啟了四個程序 worker cpu affinity 0001 0010 0100 1000 0表示不使用,1使用。0001使用cpu1,0010使用cpu2,...