Nginx配置檔案解析

2021-07-09 20:59:26 字數 644 閱讀 1098

nginx配置檔案解析

nginx配置檔案預設在/usr/local/nginx/conf/nginx.conf,配置檔案包括 全域性、event、http、server設定、event主要設定nginx的工作模式,http提供web功能

server用來設定虛擬主機,server必須位於http內部,乙個配置檔案中可以有多個server。

# 設定使用者和組

# user nobody

# 啟動子程序,包括通過ps aux | grep nginx檢視

worker_log logs/error.log info;

#程序號儲存

#設定錯誤**對應的頁面

#nginx設定404頁面

#error_page 404      /404.html

#nginx設定500  502 503 504 錯誤

#redirect server error pages to the static  page /50x.html

error_page  500  502  503 504 /50x.html

location = /50x.html 

nginx配置檔案解析

nginx為微核心加可擴充套件模組。自身模組有core event http mail等核心模組。開發者可以基於這些核心模組開發滿足自身業務需求的模組,主要是http模組。nginx的配置項的資料結構 struct ngx cycle sconf ctx是乙個指標陣列,陣列一共有ngx max mo...

nginx配置檔案解析

nginx 監聽原理 先監聽埠 再配置網域名稱 匹配到就訪問local 否則 沒有匹配到網域名稱就預設訪問第乙個監聽埠的local位址 定義錯誤頁面,如果是500錯誤,則把站點根目錄下的50x.html返回給使用者 location 50x.html nginx 監聽原理 先監聽埠 再配置網域名稱 ...

nginx配置檔案解析

nginx配置在conf nginx.conf中,主要有全域性,http,server,location塊配置 user nobody 執行使用者為nobody使用者 worker processes 3 工作程序數 worker cpu affinity 01 10 10 將工作程序放入cpu的哪...