1. 程式人生 > >nginx增加第三方模塊

nginx增加第三方模塊

文件小 但是 -m echo urg reload usr apach -s

增加第三方模塊


============================================================

一、概述
nginx文件非常小但是性能非常的高效,這方面完勝apache。
nginx文件小的一個原因之一是nginx自帶的功能相對較少,好在nginx允許第三方模塊,第三方模塊使得
nginx越發的強大。

nginx已支持動態加載模塊

二、安裝第三方模塊
./configure --prefix=源安裝目錄 --add-module=/第三方模塊解壓目錄

以安裝ngx_cache_purge模塊實例
場景一: 在未安裝nginx的情況下安裝nginx第三方模塊
# ./configure \

--prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_image_filter_module \
--add-module=/nginx_module/ngx_cache_purge \
--add-module=/nginx_module/echo-nginx-module-0.58
# make
# make install
# /usr/local/nginx/sbin/nginx


場景二:在已安裝nginx情況下安裝nginx模塊
# /usr/local/nginx/sbin/nginx -V
# ./configure --prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_image_filter_module \
--add-module=/nginx_module/ngx_cache_purge
# make
# cp objs/nginx /usr/local/nginx/sbin/nginx
# /usr/local/nginx/sbin/nginx -s reload

註意:

安裝nginx安裝第三方模塊實際上是使用–add-module重新編譯nginx二進制文件,不要make
install 而是直接把編譯目錄下objs/nginx 文件直接覆蓋老的 nginx文件


============================================================

nginx增加第三方模塊