Skip to content

Commit ee7461c

Browse files
committed
Upgraded Nginx Proxy Manager to version 2.3.1.
1 parent 3e872ef commit ee7461c

File tree

3 files changed

+110
-28
lines changed

3 files changed

+110
-28
lines changed

Dockerfile

Lines changed: 102 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,107 @@ FROM jlesage/baseimage:alpine-3.9-v2.4.3
1111
ARG DOCKER_IMAGE_VERSION=unknown
1212

1313
# Define software versions.
14-
ARG NGINX_PROXY_MANAGER_VERSION=2.2.4
14+
ARG OPENRESTY_VERSION=1.17.8.1
15+
ARG NGINX_PROXY_MANAGER_VERSION=2.3.1
1516

1617
# Define software download URLs.
18+
ARG OPENRESTY_URL=https://openresty.org/download/openresty-${OPENRESTY_VERSION}.tar.gz
1719
ARG NGINX_PROXY_MANAGER_URL=https://github.com/jc21/nginx-proxy-manager/archive/v${NGINX_PROXY_MANAGER_VERSION}.tar.gz
1820

1921
# Define working directory.
2022
WORKDIR /tmp
2123

24+
# Build and install OpenResty (nginx).
25+
RUN \
26+
add-pkg --virtual build-dependencies \
27+
build-base \
28+
curl \
29+
linux-headers \
30+
perl \
31+
pcre-dev \
32+
openssl-dev \
33+
zlib-dev \
34+
&& \
35+
# Download.
36+
echo "Downloading OpenResty..." && \
37+
mkdir openresty && \
38+
curl -# -L ${OPENRESTY_URL} | tar xz --strip 1 -C openresty && \
39+
# Compile.
40+
echo "Compiling OpenResty..." && \
41+
cd openresty && \
42+
./configure -j$(nproc) \
43+
--prefix=/var/lib/nginx \
44+
--sbin-path=/usr/sbin/nginx \
45+
--modules-path=/usr/lib/nginx/modules \
46+
--conf-path=/etc/nginx/nginx.conf \
47+
--pid-path=/var/run/nginx/nginx.pid \
48+
--lock-path=/var/run/nginx/nginx.lock \
49+
--error-log-path=/config/log/nginx/error.log \
50+
--http-log-path=/config/log/nginx/access.log \
51+
\
52+
--http-client-body-temp-path=/var/tmp/nginx/client_body \
53+
--http-proxy-temp-path=/var/tmp/nginx/proxy \
54+
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \
55+
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
56+
--http-scgi-temp-path=/var/tmp/nginx/scgi \
57+
--with-perl_modules_path=/usr/lib/perl5/vendor_perl \
58+
\
59+
--user=nginx \
60+
--group=nginx \
61+
--with-threads \
62+
--with-file-aio \
63+
\
64+
--with-http_ssl_module \
65+
--with-http_v2_module \
66+
--with-http_realip_module \
67+
--with-http_addition_module \
68+
--with-http_sub_module \
69+
--with-http_dav_module \
70+
--with-http_flv_module \
71+
--with-http_mp4_module \
72+
--with-http_gunzip_module \
73+
--with-http_gzip_static_module \
74+
--with-http_auth_request_module \
75+
--with-http_random_index_module \
76+
--with-http_secure_link_module \
77+
--with-http_degradation_module \
78+
--with-http_slice_module \
79+
--with-http_stub_status_module \
80+
--with-stream \
81+
--with-stream_ssl_module \
82+
--with-stream_realip_module \
83+
--with-stream_ssl_preread_module \
84+
--with-pcre-jit \
85+
&& \
86+
make -j$(nproc) && \
87+
# Install.
88+
echo "Installing OpenResty..." && \
89+
make install && \
90+
find /var/lib/nginx/ -type f -name '*.so*' -exec strip {} ';' && \
91+
strip /usr/sbin/nginx && \
92+
cd .. && \
93+
# Cleanup.
94+
del-pkg build-dependencies && \
95+
rm -r \
96+
/var/lib/nginx/bin/opm \
97+
/var/lib/nginx/bin/nginx-xml2pod \
98+
/var/lib/nginx/bin/restydoc-index \
99+
/var/lib/nginx/bin/restydoc \
100+
/var/lib/nginx/bin/md2pod.pl \
101+
/var/lib/nginx/luajit/include \
102+
/var/lib/nginx/luajit/lib/libluajit-5.1.a \
103+
/var/lib/nginx/luajit/lib/pkgconfig \
104+
/var/lib/nginx/luajit/share/man \
105+
/var/lib/nginx/pod \
106+
/var/lib/nginx/resty.index \
107+
/var/lib/nginx/site \
108+
&& \
109+
rm -rf /tmp/* /tmp/.[!.]*
110+
22111
# Install dependencies.
23112
RUN \
24113
add-pkg \
25114
nodejs \
26-
nginx \
27-
nginx-mod-stream \
28115
mariadb \
29116
mariadb-client \
30117
mariadb-server-utils \
@@ -39,25 +126,6 @@ RUN \
39126
rm -r \
40127
/var/lib/mysql \
41128
&& \
42-
# Clean some uneeded stuff from nginx.
43-
mv /etc/nginx/fastcgi.conf /tmp/ && \
44-
mv /etc/nginx/fastcgi_params /tmp/ && \
45-
rm -r \
46-
/var/log/nginx \
47-
/var/lib/nginx \
48-
/var/tmp/nginx \
49-
/etc/nginx \
50-
/etc/init.d/nginx \
51-
/etc/logrotate.d/nginx \
52-
/var/www && \
53-
mkdir /etc/nginx && \
54-
mv /tmp/fastcgi.conf /etc/nginx/ && \
55-
mv /tmp/fastcgi_params /etc/nginx/ && \
56-
ln -s /tmp/nginx /var/tmp/nginx && \
57-
# nginx always tries to open /var/lib/nginx/logs/error.log before reading
58-
# its configuration. Make sure it exists.
59-
mkdir -p /var/lib/nginx/logs && \
60-
ln -sf /config/log/nginx/error.log /var/lib/nginx/logs/error.log && \
61129
# Make sure mariadb listen on port 3306
62130
sed-patch 's/^skip-networking/#skip-networking/' /etc/my.cnf.d/mariadb-server.cnf
63131

@@ -143,8 +211,17 @@ RUN \
143211
# Remove the `user` directive, since we want nginx to run as non-root.
144212
sed-patch 's|user root;|#user root;|' /etc/nginx/nginx.conf && \
145213

146-
# Make sure nginx loads the stream module.
147-
sed-patch '/daemon off;/a load_module /usr/lib/nginx/modules/ngx_stream_module.so;' /etc/nginx/nginx.conf && \
214+
# Change log paths.
215+
sed-patch 's|/data/logs/|/config/log/|' /etc/nginx/nginx.conf && \
216+
sed-patch 's|/data/logs/|/config/log/|' /etc/nginx/conf.d/default.conf && \
217+
sed-patch 's|/data/logs/|/config/log/|' /opt/nginx-proxy-manager/templates/dead_host.conf && \
218+
sed-patch 's|/data/logs/|/config/log/|' /opt/nginx-proxy-manager/templates/default.conf && \
219+
sed-patch 's|/data/logs/|/config/log/|' /opt/nginx-proxy-manager/templates/letsencrypt-request.conf && \
220+
sed-patch 's|/data/logs/|/config/log/|' /opt/nginx-proxy-manager/templates/proxy_host.conf && \
221+
sed-patch 's|/data/logs/|/config/log/|' /opt/nginx-proxy-manager/templates/redirection_host.conf && \
222+
223+
# Change client_body_temp_path.
224+
sed-patch 's|/tmp/nginx/body|/var/tmp/nginx/body|' /etc/nginx/nginx.conf && \
148225

149226
# Redirect `/data' to '/config'.
150227
ln -s /config /data && \
@@ -153,7 +230,7 @@ RUN \
153230
mv /etc/nginx/conf.d/include/ip_ranges.conf /defaults/ && \
154231
ln -sf /config/nginx/ip_ranges.conf /etc/nginx/conf.d/include/ip_ranges.conf && \
155232

156-
# Make sure the config file for resovers is stored in persistent volume.
233+
# Make sure the config file for resolvers is stored in persistent volume.
157234
ln -sf /config/nginx/resolvers.conf /etc/nginx/conf.d/include/resolvers.conf && \
158235

159236
# Make sure nginx cache is stored on the persistent volume.

rootfs/etc/cont-init.d/nginx-proxy-manager.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@ touch /config/log/nginx/error.log
6464
touch /config/log/nginx/default.log
6565
touch /config/log/nginx/manager.log
6666

67-
# Redirect the logs directory.
68-
ln -sf log/nginx /config/logs
67+
# Make sure to remove old logs directory symlink.
68+
[ ! -L /config/logs ] || rm /config/logs
69+
70+
# Fix any references to the old log path.
71+
if ls /config/nginx/*/*.conf >/dev/null 2>&1; then
72+
sed -i 's|/data/logs/|/config/log/|' /config/nginx/*/*.conf
73+
fi
6974

7075
# Install default config.
7176
[ -f /config/nginx/ip_ranges.conf ] || cp /defaults/ip_ranges.conf /config/nginx/

rootfs/etc/services.d/nginx/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e # Exit immediately if a command exits with a non-zero status.
44
set -u # Treat unset variables as an error.
55

6-
for DIR in /run/nginx /tmp/nginx
6+
for DIR in /var/run/nginx /var/tmp/nginx
77
do
88
mkdir -p "$DIR"
99
chown app:app "$DIR"

0 commit comments

Comments
 (0)