溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Nginx之為已安裝nginx動態(tài)添加模塊的方法

發(fā)布時間:2020-09-11 12:08:15 來源:腳本之家 閱讀:178 作者:shang 欄目:服務(wù)器

說明:

已經(jīng)安裝好的nginx,需要添加一個未被編譯安裝的模塊,需要怎么弄呢?

具體:

這里以安裝第三方ngx_http_google_filter_module模塊為例

nginx的模塊是需要重新編譯nginx,而不是像apache一樣配置文件引用.so

1. 下載第三方擴(kuò)展模塊ngx_http_google_filter_module

# cd /data/software/
# git clone https://github.com/cuber/ngx_http_google_filter_module

2. 查看nginx編譯安裝時安裝了哪些模塊

# nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) 
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --add-module=/data/software/ngx_http_substitutions_filter_module

可以看出編譯安裝使用了--prefix=/usr/local/nginx --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --add-module=/data/software/ngx_http_substitutions_filter_module這些參數(shù)。--add-module=/data/software/ngx_http_substitutions_filter_module是之前編譯添加ngx_http_substitutions_filter_module模塊時添加

3. 加入需要安裝的模塊,重新編譯,如這里添加–add-module=/data/software/ngx_http_google_filter_module

# ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --add-module=/data/software/ngx_http_substitutions_filter_module --add-module=/data/software/ngx_http_google_filter_module
# make  //千萬不要make install,不然就真的覆蓋了

4. 替換nginx二進(jìn)制文件:

# cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
# cp ./objs/nginx /usr/local/nginx/sbin/

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持億速云。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI