1. 檢查是否安裝了ngx_cache_purge(我這里已經安裝好了,所以會顯示出來)
/sbin/nginx -V
2. 因為nginx是yum安裝,沒有安裝包,無法./configure
下載同版本nginx, 去 http://nginx.org/download這里找
cd /usr/software/
wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz
tar -zxvf ngx_cache_purge-2.3.tar.gz
3. 備份原來的啟動文件:mv /sbin/nginx /sbin/nginx.bak
4. cd /usr/software/nginx-1.17.3
執行configure,參數為:上面圖中的configure中參數+--add-module=/usr/software/ngx_cache_purge-2.3
輸入make進行編譯,千萬不要make install 因為會覆蓋原來已經安裝好的內容,另外,編譯必須沒錯誤才行。
5. 檢查安裝是否成功
cd /usr/software/nginx-1.17.3/objs/
./nginx -V
6. 將 /objs下的nginx文件移到 /sbin/目錄下
7. /sbin/nginx -V
8. 重啟
/sbin/nginx -c /etc/nginx/nginx.conf
/sbin/nginx -s reload