LoginSignup
1
0

More than 3 years have passed since last update.

nginx-upload-module on レポ版 nginx

Posted at

nginx-upload-moduleをレポ版nginxで使用する

service や systemctl コマンド等を使い慣れてるので、Debianのapt版nginxで動かしてみたいと思った次第。
いろんな質問フォーラムを覗いても、ソースコードからインストールしろとしか書かれてないので書いてみた。

環境は Debian 10

nginxのインストール環境を整える

apt install vim curl git gnupg2 ca-certificates lsb-release -y
echo "deb http://nginx.org/packages/debian `lsb_release -cs` nginx" | tee /etc/apt/sources.list.d/nginx.list
echo "deb http://nginx.org/packages/mainline/debian `lsb_release -cs` nginx" |  tee /etc/apt/sources.list.d/nginx.list
curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add -
apt-key fingerprint ABF5BD827BD9BF62

apt update

nginx-upload-module のダウンロード

公式マニュアルにリンクされてるvkholodkov版を使用した

cd /opt;
git clone https://github.com/vkholodkov/nginx-upload-module.git

nginxソースコードのダウンロードと環境構築

deb-src のレポジトリ設定が必要

/etc/apt/sources.list

deb http://ftp.debian.org/debian buster main contrib
deb-src http://ftp.debian.org/debian buster main contrib

deb http://ftp.debian.org/debian buster-updates main contrib

deb http://security.debian.org buster/updates main contrib

インストールに必要な環境構築

apt update
apt build-dep nginx -y

ソースコードのダウンロード

cd;
mkdir nginx && cd nginx;
apt source nginx -y

vim nginx-*/debian/rules
どのパッケージで --add-moduleするか確認する。commonの時点でインストールしたかったので以下のように記述した

common_configure_flags := ...
                        --add-module=/opt/nginx-upload-module

debファイルの生成

dpkg-buildpackage -b

インストール

色々あるが、dbgsymが含まれてるのはデバッグ用なので除外する。
インストール順は libnginx-mod系 → nginx-common → nginx-full/nginx/nginx-light になる。

ワンライナーでfull版をインストールする場合は以下の通り

ls | egrep '.deb$' | grep -v dbgsym | grep -v light | grep -v extras | grep -v nginx_ | xargs dpkg --install

アップデートされない為に

2日程放置していたら、正式版にアップグレードされていた。
自動アップデートを停止しておくといいが、脆弱になる可能性がある。定期的なメンテナンスは欠かさないようにしよう。

apt remove unattended-upgrades -y
1
0
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
1
0