├── README.md ├── nginx.conf ├── nginx.vh.default.conf └── Dockerfile /README.md: -------------------------------------------------------------------------------- 1 | # docker-nginx-vts 2 | Docker image for NGINX that includes VTS module 3 | 4 | This copies the build instructions from the official NGINX docker image but adds the VTS module 5 | -------------------------------------------------------------------------------- /nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | user nginx; 3 | worker_processes 1; 4 | 5 | error_log /var/log/nginx/error.log warn; 6 | pid /var/run/nginx.pid; 7 | 8 | 9 | events { 10 | worker_connections 1024; 11 | } 12 | 13 | 14 | http { 15 | include /etc/nginx/mime.types; 16 | default_type application/octet-stream; 17 | 18 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 19 | '$status $body_bytes_sent "$http_referer" ' 20 | '"$http_user_agent" "$http_x_forwarded_for"'; 21 | 22 | access_log /var/log/nginx/access.log main; 23 | 24 | sendfile on; 25 | #tcp_nopush on; 26 | 27 | keepalive_timeout 65; 28 | 29 | #gzip on; 30 | 31 | include /etc/nginx/conf.d/*.conf; 32 | } 33 | -------------------------------------------------------------------------------- /nginx.vh.default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name localhost; 4 | 5 | #charset koi8-r; 6 | #access_log /var/log/nginx/host.access.log main; 7 | 8 | location / { 9 | root /usr/share/nginx/html; 10 | index index.html index.htm; 11 | } 12 | 13 | #error_page 404 /404.html; 14 | 15 | # redirect server error pages to the static page /50x.html 16 | # 17 | error_page 500 502 503 504 /50x.html; 18 | location = /50x.html { 19 | root /usr/share/nginx/html; 20 | } 21 | 22 | # proxy the PHP scripts to Apache listening on 127.0.0.1:80 23 | # 24 | #location ~ \.php$ { 25 | # proxy_pass http://127.0.0.1; 26 | #} 27 | 28 | # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 29 | # 30 | #location ~ \.php$ { 31 | # root html; 32 | # fastcgi_pass 127.0.0.1:9000; 33 | # fastcgi_index index.php; 34 | # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 35 | # include fastcgi_params; 36 | #} 37 | 38 | # deny access to .htaccess files, if Apache's document root 39 | # concurs with nginx's one 40 | # 41 | #location ~ /\.ht { 42 | # deny all; 43 | #} 44 | } 45 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.8 2 | 3 | ENV NGINX_VERSION 1.15.8 4 | 5 | RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \ 6 | && CONFIG="\ 7 | --prefix=/etc/nginx \ 8 | --sbin-path=/usr/sbin/nginx \ 9 | --modules-path=/usr/lib/nginx/modules \ 10 | --conf-path=/etc/nginx/nginx.conf \ 11 | --error-log-path=/var/log/nginx/error.log \ 12 | --http-log-path=/var/log/nginx/access.log \ 13 | --pid-path=/var/run/nginx.pid \ 14 | --lock-path=/var/run/nginx.lock \ 15 | --http-client-body-temp-path=/var/cache/nginx/client_temp \ 16 | --http-proxy-temp-path=/var/cache/nginx/proxy_temp \ 17 | --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \ 18 | --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \ 19 | --http-scgi-temp-path=/var/cache/nginx/scgi_temp \ 20 | --user=nginx \ 21 | --group=nginx \ 22 | --with-http_ssl_module \ 23 | --with-http_realip_module \ 24 | --with-http_addition_module \ 25 | --with-http_sub_module \ 26 | --with-http_dav_module \ 27 | --with-http_flv_module \ 28 | --with-http_mp4_module \ 29 | --with-http_gunzip_module \ 30 | --with-http_gzip_static_module \ 31 | --with-http_random_index_module \ 32 | --with-http_secure_link_module \ 33 | --with-http_stub_status_module \ 34 | --with-http_auth_request_module \ 35 | --with-http_xslt_module=dynamic \ 36 | --with-http_image_filter_module=dynamic \ 37 | --with-http_geoip_module=dynamic \ 38 | --with-threads \ 39 | --with-stream \ 40 | --with-stream_ssl_module \ 41 | --with-stream_ssl_preread_module \ 42 | --with-stream_realip_module \ 43 | --with-stream_geoip_module=dynamic \ 44 | --with-http_slice_module \ 45 | --with-mail \ 46 | --with-mail_ssl_module \ 47 | --with-compat \ 48 | --with-file-aio \ 49 | --with-http_v2_module \ 50 | --add-module=/tmp/vozlt/nginx-module-vts" \ 51 | && addgroup -S nginx \ 52 | && adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \ 53 | && apk add --no-cache --virtual .build-deps \ 54 | gcc \ 55 | libc-dev \ 56 | make \ 57 | openssl-dev \ 58 | pcre-dev \ 59 | zlib-dev \ 60 | linux-headers \ 61 | curl \ 62 | gnupg1 \ 63 | libxslt-dev \ 64 | gd-dev \ 65 | geoip-dev \ 66 | git \ 67 | && curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \ 68 | && curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \ 69 | && export GNUPGHOME="$(mktemp -d)" \ 70 | && found=''; \ 71 | for server in \ 72 | ha.pool.sks-keyservers.net \ 73 | hkp://keyserver.ubuntu.com:80 \ 74 | hkp://p80.pool.sks-keyservers.net:80 \ 75 | pgp.mit.edu \ 76 | ; do \ 77 | echo "Fetching GPG key $GPG_KEYS from $server"; \ 78 | gpg --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$GPG_KEYS" && found=yes && break; \ 79 | done; \ 80 | test -z "$found" && echo >&2 "error: failed to fetch GPG key $GPG_KEYS" && exit 1; \ 81 | gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \ 82 | && rm -rf "$GNUPGHOME" nginx.tar.gz.asc \ 83 | && mkdir -p /usr/src \ 84 | && tar -zxC /usr/src -f nginx.tar.gz \ 85 | && rm nginx.tar.gz \ 86 | && cd /usr/src/nginx-$NGINX_VERSION \ 87 | && mkdir -p /tmp/vozlt/nginx-module-vts \ 88 | && git clone git://github.com/vozlt/nginx-module-vts.git /tmp/vozlt/nginx-module-vts \ 89 | && ./configure $CONFIG --with-debug \ 90 | && make -j$(getconf _NPROCESSORS_ONLN) \ 91 | && mv objs/nginx objs/nginx-debug \ 92 | && mv objs/ngx_http_xslt_filter_module.so objs/ngx_http_xslt_filter_module-debug.so \ 93 | && mv objs/ngx_http_image_filter_module.so objs/ngx_http_image_filter_module-debug.so \ 94 | && mv objs/ngx_http_geoip_module.so objs/ngx_http_geoip_module-debug.so \ 95 | && mv objs/ngx_stream_geoip_module.so objs/ngx_stream_geoip_module-debug.so \ 96 | && ./configure $CONFIG \ 97 | && make -j$(getconf _NPROCESSORS_ONLN) \ 98 | && make install \ 99 | && rm -rf /tmp/vozlt/nginx-module-vts/ \ 100 | && rm -rf /etc/nginx/html/ \ 101 | && mkdir /etc/nginx/conf.d/ \ 102 | && mkdir -p /usr/share/nginx/html/ \ 103 | && install -m644 html/index.html /usr/share/nginx/html/ \ 104 | && install -m644 html/50x.html /usr/share/nginx/html/ \ 105 | && install -m755 objs/nginx-debug /usr/sbin/nginx-debug \ 106 | && install -m755 objs/ngx_http_xslt_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_xslt_filter_module-debug.so \ 107 | && install -m755 objs/ngx_http_image_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_image_filter_module-debug.so \ 108 | && install -m755 objs/ngx_http_geoip_module-debug.so /usr/lib/nginx/modules/ngx_http_geoip_module-debug.so \ 109 | && install -m755 objs/ngx_stream_geoip_module-debug.so /usr/lib/nginx/modules/ngx_stream_geoip_module-debug.so \ 110 | && ln -s ../../usr/lib/nginx/modules /etc/nginx/modules \ 111 | && strip /usr/sbin/nginx* \ 112 | && strip /usr/lib/nginx/modules/*.so \ 113 | && rm -rf /usr/src/nginx-$NGINX_VERSION \ 114 | \ 115 | # Bring in gettext so we can get `envsubst`, then throw 116 | # the rest away. To do this, we need to install `gettext` 117 | # then move `envsubst` out of the way so `gettext` can 118 | # be deleted completely, then move `envsubst` back. 119 | && apk add --no-cache --virtual .gettext gettext \ 120 | && mv /usr/bin/envsubst /tmp/ \ 121 | \ 122 | && runDeps="$( \ 123 | scanelf --needed --nobanner --format '%n#p' /usr/sbin/nginx /usr/lib/nginx/modules/*.so /tmp/envsubst \ 124 | | tr ',' '\n' \ 125 | | sort -u \ 126 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 127 | )" \ 128 | && apk add --no-cache --virtual .nginx-rundeps $runDeps \ 129 | && apk del .build-deps \ 130 | && apk del .gettext \ 131 | && mv /tmp/envsubst /usr/local/bin/ \ 132 | \ 133 | # Bring in tzdata so users could set the timezones through the environment 134 | # variables 135 | && apk add --no-cache tzdata \ 136 | \ 137 | # forward request and error logs to docker log collector 138 | && ln -sf /dev/stdout /var/log/nginx/access.log \ 139 | && ln -sf /dev/stderr /var/log/nginx/error.log 140 | 141 | COPY nginx.conf /etc/nginx/nginx.conf 142 | COPY nginx.vh.default.conf /etc/nginx/conf.d/default.conf 143 | 144 | EXPOSE 80 145 | 146 | STOPSIGNAL SIGTERM 147 | 148 | CMD ["nginx", "-g", "daemon off;"] 149 | --------------------------------------------------------------------------------