Skip to content

Instantly share code, notes, and snippets.

@concatime
Last active April 19, 2018 21:42
Show Gist options
  • Save concatime/408a0d8dc3e3a1973ba5f38012f3753f to your computer and use it in GitHub Desktop.
Save concatime/408a0d8dc3e3a1973ba5f38012f3753f to your computer and use it in GitHub Desktop.
[DEPRECATED] ngx_wizard.sh

DEPRECATED, evolved to this.

NGX=1.14.0
LIBRESSL=2.7.2
LIBATOMIC=7.6.4
JEMALLOC=5.0.1
PCRE=8.42
sudo echo 'You should have git, curl, make and g++ installed BEFORE running this script!'
read -p 'Press ENTER to continue, otherwise hit CNTRL’C to abort'
set -e
pushd $(mktemp --directory)
echo 'Getting dependencies: NGiИX, ngx_brotli, LibreSSL, Atomic, Jemalloc & PCRE'
for k in nginx.org/download/nginx-$NGX ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-$LIBRESSL ftp.pcre.org/pub/pcre/pcre-$PCRE github.com/ivmai/libatomic_ops/releases/download/v$LIBATOMIC/libatomic_ops-$LIBATOMIC
do curl https://$k.tar.gz --location --silent | tar xz &
done
curl https://github.com/jemalloc/jemalloc/releases/download/5.0.1/jemalloc-$JEMALLOC.tar.bz2 --location | tar xj
git clone https://github.com/google/ngx_brotli.git --recursive
wait
ln --symbolic .libs/libatomic_ops.a libatomic_ops-$LIBATOMIC/src
pushd jemalloc-$JEMALLOC
./configure
make build_lib_static
popd
pushd nginx-$NGX
./configure \
--prefix=/opt/nginx \
--pid-path=/run/nginx.pid \
--group=nginx \
--add-module=../ngx_brotli \
--with-openssl=../libressl-$LIBRESSL \
--with-libatomic=../libatomic_ops-$LIBATOMIC \
--with-pcre=../pcre-$PCRE \
--with-pcre-jit \
--with-stream \
--with-threads \
--with-file-aio \
--with-http_v2_module \
--with-http_ssl_module \
--with-stream_ssl_module \
--without-http_gzip_module \
--without-select_module \
--without-poll_module \
--without-mail_pop3_module \
--without-mail_imap_module \
--without-mail_smtp_module \
--with-ld-opt="-pie -ljemalloc -L../jemalloc-$JEMALLOC/lib -Wl,-z,relro,-z,now -Wl,--as-needed" \
--with-cc-opt='-pipe -Wno-error -g -O3 -march=native -fuse-ld=gold -flto -fPIE -fsched-pressure -fstack-protector-strong --param=ssp-buffer-size=4 -Wp,-D_FORTIFY_SOURCE=2 -DTCP_FASTOPEN=23'
make -j`nproc`
sudo make install
popd
rm `pwd` --recursive --force
popd
pushd /opt/nginx
sudo mkdir sites-available sites-enabled
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment