LoginSignup

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 5 years have passed since last update.

[READY] Nginxをソースからビルドする

Last updated at Posted at 2017-01-27

古いUbuntuなどを使っているとapt-getでインストールできるNginxが古くて、使いたいモジュールがサポートされていないことがあります。その場合、ソースからビルドする必要があります。

ダウンロードします。

curl -L https://nginx.org/download/nginx-1.10.2.tar.gz -o nginx-1.10.2.tar.gz

tarballを解凍します。

tar zxvf nginx-1.10.2.tar.gz

buildします。

cd nginx-1.10.2
./configure
make

ビルドできたらmake installでインストールします。

インストール先のディレクトリを指定する

何も指定せずにインストールすると /usr/local/nginx にインストールされます。このディレクトリを変更するには --prefix=INSTALL_PATH でインストールしたいディレクトリを指定します。他のパッケージでも同様ですね。

./configure --prefix=/path/to/your/install/dir
make

モジュールを有効にする

モジュールによってはデフォルトでは組み込まれないものがあります。それらを有効にするにはconfigureスクリプトのオプションで使いたいモジュールを指定します。例えばhttp_auth_request_moduleを有効にするには--with-http_auth_request_moduleを指定します。

./configure --with-http_auth_request_module
make

参考

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