Nginxへのモジュールの動的追加
ここでは、サードパーティ製の ngx_http_google_filter_module モジュールをインストールする例を示します。
NginxのモジュールはApacheのように.soを参照する設定ファイルの代わりにNginxを再コンパイルするために必要です。
サードパーティ製拡張モジュール ngx_http_google_filter_module のダウンロード
# cd /data/software/
# git clone https://.com/cuber/ngx_http_google_filter_module·
nginxのコンパイルとインストール時にインストールされるモジュールを確認するには
コマンドラインをNginx実行ファイルがあるディレクトリに切り替え、 ./nginx -Vと入力してください:
[root@binghe sbin]# ./nginx -V
nginx version: nginx/1.19.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)
built with OpenSSL 1.0.2 22 Jan 2015
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx-1.19.1 --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
[root@binghe sbin]#
Nginxのコンパイルとインストールに使用されるパラメータは以下のとおりです:
--prefix=/usr/local/nginx-1.19.1 --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 をここに追加します:
with-zlib=/usr/local/src/zlib-1.2.8 --with-http_ssl_module --追加モジュール=/data/software/ngx_http_google_filter_module
その後、以下のようにコンパイル作業を行います:
# make //を上書きすることになる。
ここで注意:make installコマンドは実行しないでください。
nginxバイナリの置き換え
新しくコンパイルしたnginxの実行ファイルを/usr/local/nginx-1.19.1/sbin/ディレクトリにコピーします。





