-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-nginx.sh
executable file
·62 lines (54 loc) · 1.25 KB
/
build-nginx.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
apk update
apk upgrade
apk add --no-cache --virtual .run-deps \
openssl
apk add --no-cache --virtual .build-deps \
alpine-sdk \
git \
openssl-dev
mkdir /build
cd /build
wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
tar -zxf pcre-8.43.tar.gz
cd pcre-8.43
./configure
make
make install
cd /build
wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
make install
cd /build
git clone https://github.com/evanmiller/mod_zip.git
wget https://nginx.org/download/nginx-$STABLE.tar.gz
tar zxf nginx-$STABLE.tar.gz
cd nginx-$STABLE
./configure \
--prefix=/etc/nginx \
--sbin-path=/etc/nginx/nginx \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/etc/nginx/nginx.pid \
--with-pcre=../pcre-8.43 \
--with-zlib=../zlib-1.2.11 \
--with-http_ssl_module \
--with-stream \
--with-mail=dynamic \
--with-http_addition_module \
--add-module=/build/mod_zip
make
make install
ln -sf /etc/nginx/nginx /bin/nginx
cd /
rm -rf /build
apk del .build-deps
# forward request and error logs to docker log collector
mkdir /var/log/nginx
ln -sf /dev/stdout /etc/nginx/logs/access.log
ln -sf /dev/stderr /etc/nginx/logs/error.log
addgroup -S nginx
adduser -S -G nginx -H -s /bin/false -D nginx
addgroup -S www
adduser -S -G www -H -s /bin/false -D www