nginx的配置說明

2022-09-01 08:06:09 字數 1562 閱讀 3743

#定義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;

#fastcgi相關引數是為了改善**的效能:減少資源占用,提高訪問速度。下面引數看字面意思都能理解。

fastcgi_connect_timeout 300;

fastcgi_send_timeout 300;

fastcgi_read_timeout 300;

fastcgi_buffer_size 64k;

fastcgi_buffers 4 64k;

fastcgi_busy_buffers_size 128k;

fastcgi_temp_file_write_size 128k;

upstream blog.ha97.com

#虛擬主機的配置

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 配置說明

定義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...