Commit | Line | Data |
---|---|---|
e8b9677b S |
1 | #!/bin/bash |
2 | set -e | |
e8b9677b | 3 | |
89620297 | 4 | # version check: https://nginx.org/en/download.html |
8c7a9f14 | 5 | VERSION=1.17.9 |
89620297 | 6 | HASH="7dd65d405c753c41b7fdab9415cfb4bdbaf093ec6d9f7432072d52cb7bcbb689" |
e8b9677b | 7 | |
89620297 | 8 | apt install -y autoconf |
e8b9677b | 9 | |
89620297 | 10 | cd /tmp |
e8b9677b S |
11 | git clone https://github.com/bagder/libbrotli |
12 | cd libbrotli | |
13 | ./autogen.sh | |
14 | ./configure | |
15 | make install | |
16 | ||
17 | cd /tmp | |
e8b9677b | 18 | curl -O https://nginx.org/download/nginx-$VERSION.tar.gz |
89620297 MB |
19 | sha256sum nginx-$VERSION.tar.gz |
20 | echo "$HASH nginx-$VERSION.tar.gz" | sha256sum -c | |
e8b9677b S |
21 | tar zxf nginx-$VERSION.tar.gz |
22 | cd nginx-$VERSION | |
23 | ||
70a33234 MB |
24 | # nginx-common for boilerplate files etc. |
25 | apt install -y nginx-common libpcre3 libpcre3-dev zlib1g zlib1g-dev | |
e8b9677b | 26 | |
89620297 MB |
27 | cd /tmp |
28 | # this is the reason we are compiling by hand... | |
29 | git clone https://github.com/google/ngx_brotli.git | |
1cd6aa50 | 30 | # now ngx_brotli has brotli as a submodule |
89620297 MB |
31 | cd /tmp/ngx_brotli |
32 | git submodule update --init | |
f834837d | 33 | |
89620297 | 34 | cd /tmp/nginx-$VERSION |
f834837d | 35 | # ignoring depracations with -Wno-deprecated-declarations while we wait for this https://github.com/google/ngx_brotli/issues/39#issuecomment-254093378 |
f2eb9847 | 36 | ./configure --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wno-deprecated-declarations' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_v2_module --with-http_sub_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads --add-module=/tmp/ngx_brotli |
e8b9677b S |
37 | |
38 | make install | |
e51e80ad S |
39 | |
40 | mv /usr/share/nginx/sbin/nginx /usr/sbin | |
41 | ||
e8b9677b S |
42 | cd / |
43 | rm -fr /tmp/nginx | |
44 | rm -fr /tmp/libbrotli | |
45 | rm -fr /tmp/ngx_brotli | |
416467f6 | 46 | rm -fr /etc/nginx/modules-enabled/* |