Last active
March 18, 2016 12:25
-
-
Save niklasvincent/bc1a598fea30dc19e34a to your computer and use it in GitHub Desktop.
nginx-build.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
NGINX_VERSION="1.9.12" | |
NGINX_TARBALL="nginx-${NGINX_VERSION}.tar.gz" | |
PCRE_VERSION="8.38" | |
PCRE_TARBALL="pcre-${PCRE_VERSION}.tar.gz" | |
OPENSSL_VERSION="1.0.1s" | |
OPENSSL_TARBALL="openssl-${OPENSSL_VERSION}.tar.gz" | |
ZLIB_VERSION="1.2.8" | |
ZLIB_TARBALL="zlib-${ZLIB_VERSION}.tar.gz" | |
if [[ "${1}" == "clean" ]]; then | |
rm -rf nginx* | |
rm -rf pcre-* | |
rm -rf openssl-* | |
exit 0 | |
fi | |
if [[ -d "nginx" ]]; then | |
rm -rf nginx | |
fi | |
CWD=$(pwd) | |
if [[ ! -d "${NGINX_TARBALL%.tar.gz}" ]]; then | |
wget "http://nginx.org/download/${NGINX_TARBALL}" | |
tar xvzf "${NGINX_TARBALL}" && rm -f "${NGINX_TARBALL}" | |
fi | |
if [[ ! -d "${PCRE_TARBALL%.tar.gz}" ]]; then | |
wget "http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${PCRE_TARBALL}" | |
tar xvzf "${PCRE_TARBALL}" && rm -f "${PCRE_TARBALL}" | |
fi | |
if [[ ! -d "${OPENSSL_TARBALL%.tar.gz}" ]]; then | |
wget "http://www.openssl.org/source/${OPENSSL_TARBALL}" | |
tar xvzf "${OPENSSL_TARBALL}" && rm -f "${OPENSSL_TARBALL}" | |
cd "${OPENSSL_TARBALL%.tar.gz}" | |
cd ${CWD} | |
fi | |
if [[ ! -d "${ZLIB_TARBALL%.tar.gz}" ]]; then | |
wget "http://zlib.net/${ZLIB_TARBALL}" | |
tar xvzf "${ZLIB_TARBALL}" && rm -rf "${ZLIB_TARBALL}" | |
fi | |
cd "nginx-${NGINX_VERSION}" | |
mkdir ../nginx | |
./configure \ | |
--with-cpu-opt=generic \ | |
--with-pcre=../pcre-${PCRE_VERSION} \ | |
--sbin-path=. \ | |
--pid-path=./nginx.pid \ | |
--conf-path=./nginx.conf \ | |
--with-openssl-opt=no-krb5 \ | |
--with-ld-opt="-static" \ | |
--with-openssl=../openssl-${OPENSSL_VERSION} \ | |
--with-http_ssl_module \ | |
--with-http_gzip_static_module \ | |
--with-file-aio \ | |
--with-zlib=../zlib-${ZLIB_VERSION} \ | |
--with-pcre \ | |
--with-cc-opt="-O2 -static -static-libgcc" \ | |
--with-http_charset_module \ | |
--with-http_ssi_module \ | |
--with-http_userid_module \ | |
--with-http_access_module \ | |
--with-http_auth_basic_module \ | |
--with-http_autoindex_module \ | |
--with-http_geo_module \ | |
--with-http_map_module \ | |
--with-http_split_clients_module \ | |
--with-http_referer_module \ | |
--with-http_proxy_module \ | |
--with-http_fastcgi_module \ | |
--with-http_uwsgi_module \ | |
--with-http_scgi_module \ | |
--with-http_memcached_module \ | |
--with-http_empty_gif_module \ | |
--with-http_browser_module \ | |
--with-http_upstream_ip_hash_module \ | |
--with-http_upstream_least_conn_module \ | |
--with-http_upstream_keepalive_module \ | |
--without-mail_pop3_module \ | |
--without-mail_imap_module \ | |
--without-mail_smtp_module | |
sed -i "/CFLAGS/s/ \-O //g" objs/Makefile | |
make && make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment