Nginx

使用 PPA 使用額外的模組重建 Nginx

  • March 30, 2018

我正在嘗試在 Ubuntu 16.04.4 LTS 上安裝RTMP 模組。這是我所做的…

add-apt-repository -y ppa:nginx/stable
vim /etc/apt/sources.list.d/nginx-ubuntu-stable-xenial.list
# Uncomment deb-src http://ppa.launchpad.net/nginx/stable/ubuntu xenial main
apt-get update

apt-get install dpkg-dev

mkdir /usr/src/nginx && cd /usr/src/nginx
apt-get source nginx
git clone https://github/arut/nginx-rtmp-module.git

cd nginx-1.12.2
vim debian/rules
# Added --add-module=/usr/src/nginx/nginx-rtmp-module to the full install flags

apt-get build-dep nginx
dpkg-buildpackage -b
cd ../
dpkg --install nginx-common_1.12.2-0+xenial0_all.deb nginx-full_1.12.2-0+xenial0_amd64.deb

但是,當嘗試執行安裝命令時,出現以下錯誤…

(Reading database ... 100580 files and directories currently installed.)
Preparing to unpack nginx-common_1.12.2-0+xenial0_all.deb ...
Unpacking nginx-common (1.12.2-0+xenial0) over (1.12.2-0+xenial0) ...
Preparing to unpack nginx-full_1.12.2-0+xenial0_amd64.deb ...
Unpacking nginx-full (1.12.2-0+xenial0) over (1.12.2-0+xenial0) ...
Setting up nginx-common (1.12.2-0+xenial0) ...
dpkg: dependency problems prevent configuration of nginx-full:
nginx-full depends on libnginx-mod-http-auth-pam (= 1.12.2-0+xenial0); however:
 Package libnginx-mod-http-auth-pam is not installed.
nginx-full depends on libnginx-mod-http-dav-ext (= 1.12.2-0+xenial0); however:
 Package libnginx-mod-http-dav-ext is not installed.
nginx-full depends on libnginx-mod-http-echo (= 1.12.2-0+xenial0); however:
 Package libnginx-mod-http-echo is not installed.
nginx-full depends on libnginx-mod-http-geoip (= 1.12.2-0+xenial0); however:
 Package libnginx-mod-http-geoip is not installed.
nginx-full depends on libnginx-mod-http-image-filter (= 1.12.2-0+xenial0); however:
 Package libnginx-mod-http-image-filter is not installed.
nginx-full depends on libnginx-mod-http-subs-filter (= 1.12.2-0+xenial0); however:
 Package libnginx-mod-http-subs-filter is not installed.
nginx-full depends on libnginx-mod-http-upstream-fair (= 1.12.2-0+xenial0); however:
 Package libnginx-mod-http-upstream-fair is not installed.
nginx
dpkg: error processing package nginx-full (--install):
dependency problems - leaving unconfigured
Processing triggers for systemd (229-4ubuntu21.2) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
nginx-full

如果您使用來自 artful (17.10) 版本的軟體包,這是應該發生的。模組中的包/usr/lib/nginx/modules/*.so被拆分出來,所以你可以一個一個地安裝它們。這有一個很好的副作用,即您將有更高的自由度來選擇重新編譯和安裝的內容。

兩種選擇:

  • 使用您的 Ubuntu 版本支持的 nginx 版本(刪除 PPA 版本並按照模組作者的說明進行操作,在該版本中,模組應該全部在 nginx-full 包中)
  • 使用較新的 nginx 包,但也要安裝它的拆分依賴項(將它們添加到您的dpkg -i命令中 - 您可能已經生成了所需的包 - 檢查包含的文件夾nginx-common_1.12*.deb

引用自:https://serverfault.com/questions/905250