
다음과 같이 시작하는 nginx 구성이 있습니다.
load_module modules/ndk_http_module.so;
load_module modules/ngx_http_set_misc_module.so;
load_module modules/ngx_http_headers_more_filter_module.so;
load_module modules/ngx_http_cache_purge_module.so;
다음 Dockerfile을 사용할 때:
FROM nginx:mainline
ADD config/ /etc/nginx/
EXPOSE 80
EXPOSE 443
컨테이너를 실행하려고 하면 다음 오류가 발생합니다.
2024/01/22 19:52:07 [emerg] 8#8: dlopen() "/etc/nginx/modules/ndk_http_module.so" failed (/etc/nginx/modules/ndk_http_module.so: cannot open shared object file: No such file or directory) in /etc/nginx/nginx.conf:1
webserver | nginx: [emerg] dlopen() "/etc/nginx/modules/ndk_http_module.so" failed (/etc/nginx/modules/ndk_http_module.so: cannot open shared object file: No such file or directory) in /etc/nginx/nginx.conf:1
따라서 모듈이 존재하지 않습니다. 내 질문은 어떻게 활성화할 수 있습니까? 나는 찾았다이것다음과 같이 모듈을 설치하는 post
$> sudo apt install software-properties-common
$> nginx=stable
$> sudo add-apt-repository ppa:nginx/$nginx
$> sudo apt update
$> sudo apt dist-upgrade
$> sudo apt install nginx-extras
그러나 명령에서 sudo add-apt-repository ppa:nginx/$nginx
오류가 발생합니다.
17.78 Setting up packagekit-tools (1.2.6-5) ...
17.79 Setting up software-properties-common (0.99.30-4) ...
17.90 Processing triggers for dbus (1.14.10-1~deb12u1) ...
18.15 Traceback (most recent call last):
18.15 File "/usr/bin/add-apt-repository", line 362, in <module>
18.15 sys.exit(0 if addaptrepo.main() else 1)
18.15 ^^^^^^^^^^^^^^^^^
18.15 File "/usr/bin/add-apt-repository", line 345, in main
18.15 shortcut = handler(source, **shortcut_params)
18.15 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18.15 File "/usr/lib/python3/dist-packages/softwareproperties/shortcuts.py", line 40, in shortcut_handler
18.15 return handler(shortcut, **kwargs)
18.15 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
18.15 File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 86, in __init__
18.15 if self.lpppa.publish_debug_symbols:
18.15 ^^^^^^^^^^
18.15 File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 126, in lpppa
18.15 self._lpppa = self.lpteam.getPPAByName(name=self.ppaname)
18.15 ^^^^^^^^^^^
18.15 File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 113, in lpteam
18.15 self._lpteam = self.lp.people(self.teamname)
18.15 ^^^^^^^^^^^^^^
18.15 AttributeError: 'NoneType' object has no attribute 'people'
이 시점에서 nginx 모듈을 설치하는 방법에 대해 약간 혼란스럽습니다.
답변1
해당 오류 메시지( )를 검색하면 AttributeError: 'NoneType' object has no attribute 'people'
첫 번째 결과로이 질문. 가장 많이 투표된 답변은 솔루션이 다음과 같다고 제안합니다.
apt-get install python3-launchpadlib
실제로 다음을 실행할 수 있습니다 add-apt-repository
.
$ podman run -it --rm docker.io/nginx:mainline bash
root@744ec39923cd:/# apt update >& /dev/null
root@744ec39923cd:/# apt -y install software-properties-common >& /dev/null
root@744ec39923cd:/# add-apt-repository ppa:nginx/stable
Traceback (most recent call last):
.
.
.
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 113, in lpteam
self._lpteam = self.lp.people(self.teamname)
^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'people'
root@744ec39923cd:/# apt -y install python3-launchpadlib >& /dev/null
root@744ec39923cd:/# add-apt-repository ppa:nginx/stable
Repository: 'deb https://ppa.launchpadcontent.net/nginx/stable/ubuntu/ bookworm main'
Description:
This PPA contains the latest Stable Release version of the nginx web server software.
**Only Non-End-of-Life Ubuntu Releases are supported in this PPA**
**Development releases of Ubuntu are not officially supported by this PPA, and uploads for those will not be available until actual final releases for those versions**
More info: https://launchpad.net/~nginx/+archive/ubuntu/stable
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Adding deb entry to /etc/apt/sources.list.d/nginx-ubuntu-stable-bookworm.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/nginx-ubuntu-stable-bookworm.list
Adding key to /etc/apt/trusted.gpg.d/nginx-ubuntu-stable.gpg with fingerprint 8B3981E7A6852F782CC4951600A6F0A3C300EE8C
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://deb.debian.org/debian-security bookworm-security InRelease
Get:4 http://deb.debian.org/debian bookworm/main amd64 DEP-11 Metadata [4492 kB]
Fetched 4492 kB in 1s (4458 kB/s)
Reading package lists... Done
그러나 그것은 결국 실패한다.참조된 ppaUbuntu용 패키지만 있습니다. 이미지 에 사용되는 Debian Bookworm 기반 이미지용 패키지가 없습니다 nginx:stable
.
또한 해당 PPA는 2018년에 출시된 Bionic(18.04)까지의 Ubuntu 버전만 지원합니다.
이 답변nginx 동적 모듈을 사용하여 기본 이미지를 확장하기 위한 지침이 있습니다.
필요에 따라 최신 Ubuntu 기반 이미지로 시작하는 것이 더 간단할 수도 있습니다. Nginx와 대부분의 모듈은 이미 Ubuntu용으로 패키지되어 있으므로 다음과 같은 방법으로 대부분의 작업을 수행할 수 있습니다.
FROM ubuntu:23.04
RUN apt update && apt -y install \
nginx \
libnginx-mod-http-ndk \
libnginx-mod-http-headers-more-filter \
libnginx-mod-http-cache-purge \
&& \
apt clean all
그러면 를 제외한 모든 것이 제공됩니다 ngx_http_set_misc_module.so
.