ngx module編寫初級學習

2021-08-18 10:03:56 字數 4859 閱讀 3344

因為需要,學習nginx,從最簡單的hello word開啟。多數參考與書籍《深入理解nginx》 ,對阿里以及書籍作者致敬

首先分析**

static ngx_http_module_t ngx_http_hello_module_ctx = ;
以上方法呼叫順序為
creat_main_conf

,ngx_null_command                                            //用null_command做結尾

};

ngx_http_post_read_phase:    讀取請求內容階段

ngx_http_server_rewrite_phase: server請求位址重寫階段

ngx_http_find_config_phase: 配置查詢階段

ngx_http_rewrite_phase: location請求位址重寫階段

ngx_http_post_rewrite_phase: 請求位址重寫提交階段

ngx_http_preaccess_phase: 訪問許可權檢查準備階段

ngx_http_access_phase: 訪問許可權檢查階段

ngx_http_post_access_phase: 訪問許可權檢查提交階段

ngx_http_try_files_phase: 配置項try_files處理階段

ngx_http_content_phase: 內容產生階段

ngx_http_log_phase: 日誌模組處理階段

利用ngx_http_hello_commands中的set函式 即ngx_http_hello_string和ngx_http_hello_counter解析配置檔案,此**中只是列印兩句話;解析配置完配置檔案後,呼叫ngx_http_hello_init,此處完成handler賦值。當ngixn接收到http請求的頭部資訊時,就會呼叫http框架處理請求,在ngx_http_content_phase階段,呼叫指定的handler

剛開始學習nginx,可能部分理解不到位,求輕拍

freeBSD核心模組編寫初級

預備知識 freebsd模組事件型別 typedef enum modeventtype modeventtype t 在系統中註冊乙個載入模組和模組事件處理程式 declare module name,data,sub,order name 模組的名字 data 是乙個moduledata t型別...

MySQL初級培訓 Mysql初級學習

此篇文章前提是大家已經在自己的電腦上安裝好相應的環境。下面介紹mysql的基本命令 mysql uroot p 進入mysql 如圖所示證明成功了,show databates 檢視已有資料庫,此時我的資料庫有這麼多,python3是我自己建立的,create database python3 ch...

pandas 初級學習

一維陣列 與 numpy的array 以及 list相似 series 可以儲存不同型別的資料 理解成seires的一種容器 s pd.series 1,2,3,np.nan,4,5 index a,b,c,d,e,f 返回左側為下標 一般為數字,可以額外指定 但是資料型別必須統一 pd的索引下標就...