nginx-buildとnginxのconfigureオプション
これまでnginx-buildでnginxのconfigure
オプションを細かく指定するには別途./configure
を実行するシェルスクリプトのファイルを用意しなければならなかった。そう、こんな風に。
# !/bin/sh
./configure \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
nginx-build
で上記の./configure
を実行するには-c
でこのシェルスクリプトファイルを与えてやる。
$ nginx-build -d work -c nginx-configure
このやり方はnginxのビルド方法をファイルに残せるという利点がある一方で面倒だった。
nginx-build
は元々数十台&数種類のnginxインスタンスをシームレスに構築および包括的に管理するための仕組みの一貫で開発した( & している)ものなのでこのようにビルドスクリプトをファイルに残すのは理にかなっているのだが、やはり面倒なものは面倒だ。単純にこうできるようにしたい。
$ nginx-build -d work \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--with-http_stub_status_module \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--with-debug \
--with-http_gzip_static_module \
--with-http_spdy_module \
--with-http_ssl_module \
--with-pcre-jit \
nginx-build-0.4.0
で、今日リリースしたnginx-0.4.0からこれができるようになった。
$ nginx-build -d work \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--with-http_stub_status_module \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--with-debug \
--with-http_gzip_static_module \
--with-http_spdy_module \
--with-http_ssl_module \
--with-pcre-jit
nginx-build: 0.4.0
Compiler: gc go1.4.2
2015/06/09 20:08:11 Download nginx-1.9.1.....
2015/06/09 20:08:13 Extract nginx-1.9.1.tar.gz.....
2015/06/09 20:08:13 Generate configure script for nginx-1.9.1.....
2015/06/09 20:08:13 Configure nginx-1.9.1.....
2015/06/09 20:08:19 Build nginx-1.9.1.....
2015/06/09 20:08:23 Complete building nginx!
nginx version: nginx/1.9.1
built by clang 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
built with OpenSSL 0.9.8zd 8 Jan 2015
TLS SNI support enabled
configure arguments: --with-cc-opt=-Wno-deprecated-declarations --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --http-log-path=/var/log/nginx/access.log --sbin-path=/usr/sbin/nginx --lock-path=/var/lock/nginx.lock --http-client-body-temp-path=/var/lib/nginx/body --with-http_spdy_module --with-http_stub_status_module --with-pcre-jit --with-http_ssl_module --with-http_gzip_static_module --with-debug
2015/06/09 20:08:23 Enter the following command for install nginx.
$ cd work/1.9.1/nginx-1.9.1
$ sudo make install
$
ちゃんとconfigure arguments
にnginx-build
から指定したオプションが並んでいる。
--add-module
によるサードパーティモジュールの組み込み
--add-module
によるサードパーティモジュールの組み込みもできる。
$ nginx-build -d work --add-module=../nginx/ngx_small_light
ただ、nginx本体の--add-module
とは若干仕様が異なる。以下のように--add-module
を複数使用することはできない。
$ nginx-build -d work --add-module=../nginx/ngx_small_light --add-module=../nginx/ngx_dynamic_upstream
nginx-build: 0.4.0
Compiler: gc go1.4.2
2015/06/09 20:13:07 Download nginx-1.9.1.....
2015/06/09 20:13:10 Extract nginx-1.9.1.tar.gz.....
2015/06/09 20:13:10 Generate configure script for nginx-1.9.1.....
2015/06/09 20:13:10 Configure nginx-1.9.1.....
2015/06/09 20:13:15 Build nginx-1.9.1.....
2015/06/09 20:13:18 Complete building nginx!
nginx version: nginx/1.9.1
built by clang 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
configure arguments: --with-cc-opt=-Wno-deprecated-declarations --add-module=/Users/bokko/workspace/nginx-build/../nginx/ngx_dynamic_upstream
2015/06/09 20:13:18 Enter the following command for install nginx.
$ cd work/1.9.1/nginx-1.9.1
$ sudo make install
$
nginxのビルドは成功するが、--add-module
が一つだけになってしまう。これはnginx-build
が利用しているflag
パッケージの制限によるもの。nginx-build
はこのためのワークアラウンドとして--add-module
オプションにカンマ区切りで複数のモジュールパスを指定できるようにしてある。
$ nginx-build -d work --add-module=../nginx/ngx_small_light,../nginx/ngx_dynamic_upstream
nginx-build: 0.4.0
Compiler: gc go1.4.2
2015/06/09 20:15:14 Download nginx-1.9.1.....
2015/06/09 20:15:17 Extract nginx-1.9.1.tar.gz.....
2015/06/09 20:15:17 Generate configure script for nginx-1.9.1.....
2015/06/09 20:15:17 Configure nginx-1.9.1.....
2015/06/09 20:15:22 Build nginx-1.9.1.....
2015/06/09 20:15:25 Complete building nginx!
nginx version: nginx/1.9.1
built by clang 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
configure arguments: --with-cc-opt=-Wno-deprecated-declarations --add-module=/Users/bokko/workspace/nginx-build/../nginx/ngx_small_light --add-module=/Users/bokko/workspace/nginx-build/../nginx/ngx_dynamic_upstream
2015/06/09 20:15:25 Enter the following command for install nginx.
$ cd work/1.9.1/nginx-1.9.1
$ sudo make install
$
その他の制限についてはこちらを参照。