日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

已安装nginx动态添加模块

發(fā)布時間:2023/12/10 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 已安装nginx动态添加模块 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

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

具體:
這里以安裝第三方ngx_http_google_filter_module模塊為例
nginx的模塊是需要重新編譯nginx,而不是像apache一樣配置文件引用.so
1. 下載第三方擴展模塊ngx_http_google_filter_module

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

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

#/usr/local/nginx/sbin/nginx -V 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二進制文件:

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

5. 如果不是安裝第三方插件:

--add-module替換成--with即可,例如安裝圖片縮放插件 --with-http_image_filter_module

另外附上image_filter的配置 location ~* \.(gif|png|jpg|jpeg)@(\d+)w_(\d+)h$ {rewrite ^(.+)@(\d+)w_(\d+)h$ $1 break;image_filter resize $2 $3;image_filter_buffer 10M;}

  

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

轉(zhuǎn)載于:https://www.cnblogs.com/zenghansen/p/7216905.html

總結(jié)

以上是生活随笔為你收集整理的已安装nginx动态添加模块的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。