LoginSignup
8
8

More than 5 years have passed since last update.

nginx-buildでnginxの依存ライブラリを静的に組み込む

Last updated at Posted at 2014-05-24

nginxの依存ライブラリ

nginxにはいくつか依存ライブラリがあって代表的なものは以下の3つだ。

  • zlib
  • PCRE
  • OpenSSL

実はGDも依存ライブラリの一つだが、これは特定のモジュール(ImageFilter)を組み込むときにしか必要ないのと、そもそもnginxに静的に組み込むための仕組みをnginxが提供していないので除外する。

nginx-buildで依存ライブラリを静的に組み込む

nginx-buildはこれらの依存ライブラリを静的に組み込む作業を自動化するための仕組みを提供している。手動でやるとこんな感じだ。

  • 各ライブラリのアーカイブをダウンロードする(e.g. wget http://...)
  • アーカイブを解凍する(e.g. tar zxf ...)
  • nginxのconfigureオプションにパスを指定する(e.g. --with-pcre=解凍したライブラリのパス)

これはかなりめんどくさい。nginx-buildを使えばこのあたりを自動化できる。PCREなら-pcreオプションを使う。

$ nginx-build -d work -pcre
nginx-build: 0.6.2
Compiler: gc go1.5.2
2015/12/08 04:49:37 Download nginx-1.9.7.....
2015/12/08 04:49:37 Download pcre-8.38.....
2015/12/08 04:49:40 Extract nginx-1.9.7.tar.gz.....
2015/12/08 04:49:49 Extract pcre-8.38.tar.gz.....
2015/12/08 04:49:49 Generate configure script for nginx-1.9.7.....
2015/12/08 04:49:49 Configure nginx-1.9.7.....
2015/12/08 04:49:56 Build nginx-1.9.7.....
2015/12/08 04:50:09 Complete building nginx!

nginx version: nginx/1.9.7
built by clang 7.0.0 (clang-700.1.76)
configure arguments: --with-cc-opt=-Wno-deprecated-declarations --with-pcre=../pcre-8.38

2015/12/08 04:50:09 Enter the following command for install nginx.

   $ cd work/nginx/1.9.7/nginx-1.9.7
   $ sudo make install

特定のバージョンを指定したいなら-pcreversionが利用可能だ。

$ nginx-build -d work -pcre -pcreversion=8.38

zlibなら-zlib-zibversion、OpeonSSLなら-openssl-opensslversionで同様のことが可能だ。

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8