線上nginx 平滑添加新模塊;如(--with-http_realip_module)


nginx 添加模塊
1.查看當前nginx信息(配置文件路徑,啟動用戶...)

ps aux | grep nginx

 

 

2.查看當前nginx已啟用的模塊(記錄模塊信息,安裝路徑)
./nginx -V

 

 3.官網下載對應版本的nginx源碼包(http://nginx.org/)

http://nginx.org/en/download.html

 

 

4.上傳到服務器解壓編譯

--with-http_realip_module 是nginx自帶的模塊,如是第三方模塊下載,並關注對應的版本匹配問題

在原有模塊的基礎上添加新模塊編譯:

 

 編譯通過后,make ;切記不要make install重新安裝

備份原nginx文件:

 

 

 

將編譯好的新nginx文件拿來替換:

 

 

 查看替換后的nginx模塊:

 

重新加載nginx使模塊生效:

 

 

 

備注:若是第三方模塊,只要下載對應的第三方模塊(注意與nginx版本的匹配)如(ngx_pagespeed-master);解壓在對應的目錄下,編譯的時候新增--add-module=/對應目錄/ngx_pagespeed-master;如下所示:

./configure --prefix=/apprun/nginx --with-http_ssl_module --with-http_v2_module --with-http_dav_module --with-http_stub_status_module --with-threads --with-file-aio --with-stream --with-stream_ssl_module --with-pcre --with-http_slice_module --with-http_realip_module --add-module=/usr/local/ngx_pagespeed-master


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM