Skip to content

Commit 14502e0

Browse files
committed
修复新版lua编译失败,增加geoip库
1 parent 74c43be commit 14502e0

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@ script:
1313
- docker ps -a | grep -q nginx
1414
- curl --retry 5 --retry-delay 5 -v http://127.0.0.1:30080/index.html
1515
- curl -v http://127.0.0.1:30080/purge/index.html
16-
# - curl --retry 5 --retry-delay 5 -v http://127.0.0.1:30080/lua
1716
- curl --retry 5 --retry-delay 5 -v http://127.0.0.1:30080/status1
1817
- curl --retry 5 --retry-delay 5 -v http://127.0.0.1:30080/status2

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ FROM alpine:3.5
22
LABEL maintainer "v.la@live.cn"
33

44
ENV NGINX_VERSION=1.12.1 \
5-
LUA_MODULE_VERSION=0.10.8 \
5+
LUA_MODULE_VERSION=0.10.9rc8 \
66
NGINX_DEVEL_KIT_VERSION=0.3.0 \
77
NGINX_CACHE_PURGE_VERSION=2.3 \
8+
GEOIP_VERSION=1.6.11\
89
NGINX_USER=nginx \
910
NGINX_SITECONF_DIR=/etc/nginx/sites-enabled \
1011
NGINX_LOG_DIR=/var/log/nginx \
@@ -13,7 +14,7 @@ ENV NGINX_VERSION=1.12.1 \
1314

1415
ARG WITH_DEBUG=false
1516
ARG WITH_NDK=true
16-
ARG WITH_LUA=false
17+
ARG WITH_LUA=true
1718
ARG WITH_PURGE=true
1819
ARG WITH_UPSTREAM_CHECK=true
1920

setup/install.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ NGINX_DEVEL_KIT_URL="https://github.com/simpl/ngx_devel_kit/archive/v${NGINX_DEV
88
LUA_URL="https://github.com/openresty/lua-nginx-module/archive/v${LUA_MODULE_VERSION}.tar.gz"
99
NGINX_CACHE_PURGE_URL="https://github.com/FRiCKLE/ngx_cache_purge/archive/${NGINX_CACHE_PURGE_VERSION}.tar.gz"
1010
NGINX_UPSTREAM_CHECK_URL="https://github.com/yaoweibin/nginx_upstream_check_module/archive/master.tar.gz"
11+
MAXMIND_URL="https://github.com/maxmind/geoip-api-c/releases/download/v${GEOIP_VERSION}/GeoIP-${GEOIP_VERSION}.tar.gz"
1112

1213
BUILD_DEPENDENCIES="gcc patch libc-dev make openssl-dev \
1314
curl pcre-dev zlib-dev linux-headers luajit-dev \
14-
gnupg libxslt-dev gd-dev perl-dev geoip-dev"
15+
gnupg libxslt-dev gd-dev perl-dev git geoip-dev ca-certificates"
1516

1617
${WITH_DEBUG} && {
1718
EXTRA_ARGS="${EXTRA_ARGS} --with-debug"
@@ -21,6 +22,7 @@ mkdir -p ${NGINX_SETUP_DIR}
2122
cd ${NGINX_SETUP_DIR}
2223

2324
#build dependencies
25+
echo "install build-deps $BUILD_DEPENDENCIES"
2426
apk add --no-cache --virtual .build-deps ${BUILD_DEPENDENCIES}
2527

2628
# prepare ngx_devel_kit support
@@ -54,6 +56,12 @@ ${WITH_LUA} && {
5456
export LUAJIT_INC=/usr/include/luajit-2.1
5557
}
5658

59+
# install geoip
60+
curl -fSL $MAXMIND_URL -o "${NGINX_SETUP_DIR}/geoip_module.tar"
61+
tar -zxC "${NGINX_SETUP_DIR}" -f "${NGINX_SETUP_DIR}/geoip_module.tar"
62+
cd ${NGINX_SETUP_DIR}/GeoIP-${GEOIP_VERSION}
63+
./configure && make && make check && make install
64+
5765
#nginx user role
5866
mkdir -p /var/www/nginx
5967
addgroup -S ${NGINX_USER}
@@ -87,7 +95,6 @@ fi
8795
--http-scgi-temp-path=${NGINX_TEMP_DIR}/scgi \
8896
--http-uwsgi-temp-path=${NGINX_TEMP_DIR}/uwsgi \
8997
--with-pcre-jit \
90-
--with-ipv6 \
9198
--with-http_ssl_module \
9299
--with-http_stub_status_module \
93100
--with-http_realip_module \
@@ -103,12 +110,17 @@ fi
103110
--with-http_sub_module \
104111
--with-http_flv_module \
105112
--with-http_mp4_module \
113+
--with-http_slice_module \
106114
--with-stream \
107115
--with-stream_ssl_module \
116+
--with-stream_ssl_preread_module \
117+
--with-stream_realip_module \
118+
--with-stream_geoip_module=dynamic \
108119
--with-mail \
109120
--with-mail_ssl_module \
110121
--with-threads \
111122
--with-file-aio \
123+
--with-compat \
112124
--with-http_xslt_module=dynamic \
113125
--with-http_image_filter_module=dynamic \
114126
--with-http_geoip_module=dynamic \
@@ -159,7 +171,7 @@ RUN_DEPENDENCIES="$( \
159171
| xargs -r apk info --installed \
160172
| sort -u \
161173
)"
162-
174+
echo "install rundeps $RUN_DEPENDENCIES"
163175
apk add --no-cache --virtual .nginx-rundeps $RUN_DEPENDENCIES
164176

165177
# cleanup

setup/test.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
worker_processes 1;
2-
32
pid /run/nginx.pid;
43
worker_rlimit_nofile 1024;
54

5+
load_module /etc/nginx/modules/ngx_http_geoip_module.so
6+
67
events {
78
worker_connections 1024;
89
}

0 commit comments

Comments
 (0)