這裏以安裝第三方ngx_http_google_filter_module模塊爲例nginx
nginx的模塊是須要從新編譯nginx,而不是像apache同樣配置文件引用.sogit
將命令行切換到nginx執行程序所在的目錄並輸入./nginx -V,具體以下:github
[root@liuyazhuang121 sbin]# ./nginx -V apache
nginx version: nginx/1.9.3 ide
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) ui
built with OpenSSL 1.0.2 22 Jan 2015 google
TLS SNI support enabled 命令行
configure arguments: --prefix=/usr/local/nginx-1.9.3 --with-openssl=/usr/local/src/openssl-1.0.2 --with-pcre=/usr/local/src/pcre-8.37 --with-zlib=/usr/local/src/zlib-1.2.8 --with-http_ssl_module ssl
[root@liuyazhuang121 sbin]#get
能夠看出編譯安裝使用了--prefix=/usr/local/nginx-1.9.3 --with-openssl=/usr/local/src/openssl-1.0.2 --with-pcre=/usr/local/src/pcre-8.37 --with-zlib=/usr/local/src/zlib-1.2.8 --with-http_ssl_module這些參數。
這裏添加-–add-module=/data/software/ngx_http_google_filter_module
具體以下:
複製代碼代碼以下:
./configure --prefix=/usr/local/nginx-1.9.3 --with-openssl=/usr/local/src/openssl-1.0.2 --with-pcre=/usr/local/src/pcre-8.37 --with-zlib=/usr/local/src/zlib-1.2.8 --with-http_ssl_module -–add-module=/data/software/ngx_http_google_filter_module
如上,將以前安裝Nginx的參數所有加上,最後添加-–add-module=/data/software/ngx_http_google_filter_module
以後,咱們要進行編譯操做,以下: