Skip to content

Commit eb22bc4

Browse files
committed
Update nginx build
1 parent b788938 commit eb22bc4

File tree

7 files changed

+37
-20
lines changed

7 files changed

+37
-20
lines changed

nginx/Dockerfile

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,46 @@
11
FROM debian:stretch-slim
22

33
ENV \
4+
# http://nginx.org/en/CHANGES
5+
NGINX_VERSION=1.15.9 \
46
# LUAJIT_VERSION=v2.0.5 \
57
# LUA_NGINX_MODULE_VERSION=v0.10.11 \
8+
# https://github.com/openresty/echo-nginx-module/releases
69
ECHO_NGINX_MODULE_VERSION=v0.61 \
710
MODSECURITY_VERSION=v3.0.0-rc1 \
811
MODSECURITY_NGINX_VERSION=master \
912
MODSECURITY_NGINX_COMMIT=a2a5858d249222938c2f5e48087a922c63d7f9d8 \
10-
NGINSCRIPT_VERSION=0.2.2 \
13+
# http://hg.nginx.org/njs/tags
14+
NGINSCRIPT_VERSION=0.2.8 \
1115
NGX_BROTLI_VERSION=master \
1216
NGX_DEVEL_KIT_VERSION=v0.3.0 \
1317
NGX_HTTP_REDIS=0.3.8 \
1418
NGINX_MODULE_VTS_VERSION=v0.1.18 \
15-
NGINX_VERSION=1.14.0 \
1619
REDIS2_NGINX_MODULE_VERSION=v0.14 \
1720
SET_MISC_NGINX_MODULE_VERSION=v0.31 \
18-
SRCACHE_NGINX_MODULE_VERSION=v0.31
21+
SRCACHE_NGINX_MODULE_VERSION=v0.31 \
22+
NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62
1923

2024
RUN adduser --system --disabled-password --home /var/cache/nginx --shell /sbin/nologin --group nginx \
2125
&& apt-get update \
22-
&& apt-get install -y \
26+
&& apt-get install --no-install-recommends --no-install-suggests -y gnupg1 apt-transport-https ca-certificates \
27+
&& \
28+
found=''; \
29+
for server in \
30+
ha.pool.sks-keyservers.net \
31+
hkp://keyserver.ubuntu.com:80 \
32+
hkp://p80.pool.sks-keyservers.net:80 \
33+
pgp.mit.edu \
34+
; do \
35+
echo "Fetching GPG key $NGINX_GPGKEY from $server"; \
36+
apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
37+
done; \
38+
test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; \
39+
apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* \
40+
&& echo "deb https://nginx.org/packages/mainline/debian/ stretch nginx" >> /etc/apt/sources.list.d/nginx.list \
41+
&& echo "deb-src https://nginx.org/packages/mainline/debian/ stretch nginx" >> /etc/apt/sources.list.d/nginx.list \
42+
&& apt-get update \
43+
&& apt-get install --no-install-recommends --no-install-suggests -y \
2344
inotify-tools \
2445
curl \
2546
libyajl-dev \
@@ -48,7 +69,7 @@ RUN adduser --system --disabled-password --home /var/cache/nginx --shell /sbin/n
4869
&& cd ModSecurity \
4970
&& sh build.sh \
5071
&& git submodule update --init \
51-
&& ./configure \
72+
&& ./configure --disable-doxygen-doc --disable-examples --disable-dependency-tracking \
5273
&& make \
5374
&& make install \
5475
&& cd .. \
@@ -66,11 +87,6 @@ RUN adduser --system --disabled-password --home /var/cache/nginx --shell /sbin/n
6687
&& curl https://people.freebsd.org/~osa/ngx_http_redis-${NGX_HTTP_REDIS}.tar.gz | tar xz \
6788
&& git clone https://github.com/vozlt/nginx-module-vts.git --branch ${NGINX_MODULE_VTS_VERSION} --single-branch \
6889
&& curl -L https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar xz \
69-
# download GeoIP databases
70-
&& wget -O /etc/nginx/GeoIP.dat.gz https://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz \
71-
&& wget -O /etc/nginx/GeoLiteCity.dat.gz https://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz \
72-
&& gunzip /etc/nginx/GeoIP.dat.gz \
73-
&& gunzip /etc/nginx/GeoLiteCity.dat.gz \
7490
# Nginx Devel Kit
7591
&& git clone https://github.com/simpl/ngx_devel_kit.git --branch ${NGX_DEVEL_KIT_VERSION} --single-branch \
7692
# Set Misc Nginx Module
@@ -175,7 +191,8 @@ RUN adduser --system --disabled-password --home /var/cache/nginx --shell /sbin/n
175191
&& ln -sf /dev/stdout /var/log/nginx/access.log \
176192
&& ln -sf /dev/stderr /var/log/nginx/error.log
177193

178-
COPY entrypoint.sh /entrypoint.sh
194+
COPY entrypoint.sh /
195+
COPY files/geoip/ /etc/nginx/
179196
RUN chmod +x /entrypoint.sh
180197
ENTRYPOINT ["/entrypoint.sh"]
181198

nginx/docker-compose.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
nginx:
2-
# image: nginx
32
build: .
4-
# command: [nginx-debug, '-g', 'daemon off;']
53
volumes:
64
- ./files/conf/nginx.conf:/etc/nginx/nginx.conf
7-
- ./files/conf/conf.d/site.conf:/etc/nginx/conf.d/site.conf
8-
- ./files/modsec_includes.conf:/etc/nginx//modsec_includes.conf
9-
- ./files/modsec_custom.conf:/etc/nginx//modsec_custom.conf
5+
- ./files/conf/conf.d/:/etc/nginx/conf.d/
6+
- ./files/modsec_includes.conf:/etc/nginx/modsec_includes.conf
7+
- ./files/modsec_custom.conf:/etc/nginx/modsec_custom.conf
108
- ./files/modsecurity.conf:/etc/nginx/modsecurity.conf
119
- ./files/crs-setup.conf:/etc/nginx/rules/crs-setup.conf
1210
environment:

nginx/files/conf/conf.d/site.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ server {
22
listen 80;
33
server_name localhost;
44

5-
modsecurity on;
6-
modsecurity_rules_file /etc/nginx/modsec_includes.conf;
7-
location / {
5+
# modsecurity on;
6+
# modsecurity_rules_file /etc/nginx/modsec_includes.conf;
7+
# location / {
88

9-
}
9+
# }
1010
}

nginx/files/conf/nginx.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ worker_processes auto;
44
error_log /var/log/nginx/error.log warn;
55
pid /var/run/nginx.pid;
66

7+
load_module /usr/lib/nginx/modules/ngx_http_geoip_module.so;
8+
79
events {
810
worker_connections 1024;
911
}

nginx/files/geoip/GeoIP.dat

1.19 MB
Binary file not shown.

nginx/files/geoip/GeoIPASNum.dat

4.42 MB
Binary file not shown.

nginx/files/geoip/GeoLiteCity.dat

19.6 MB
Binary file not shown.

0 commit comments

Comments
 (0)