Created
September 18, 2014 13:57
-
-
Save vidakovic/19f57c936b3b6a5f4a15 to your computer and use it in GitHub Desktop.
Nginx RTMP download and compile
This file contains 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/sh | |
NGINX_FILE=$(wget -O- http://nginx.org/download | egrep -o 'nginx-[0-9\-\.]+.tar.gz' | sort -V | tail -1) | |
NGINX_RTMP_FILE=$(wget -O- https://github.com/arut/nginx-rtmp-module/releases | egrep -o '/arut/nginx-rtmp-module/archive/v[0-9\-\.]+.tar.gz' | sed "s/\/arut\/nginx-rtmp-module\/archive\///" | sort -V | tail -1) | |
#NGINX_PAGESPEED_FILE=$(wget -O- https://github.com/pagespeed/ngx_pagespeed/releases | egrep -o '/pagespeed/ngx_pagespeed/archive/v[a-z0-9\.\-]+.tar.gz' | sed "s/\/pagespeed\/ngx_pagespeed\/archive\///" | sort -V | tail -1) | |
NGINX_PAGESPEED_FILE="v1.8.31.4-beta.tar.gz" | |
NGINX_PAGESPEED_VERSION=$(echo $NGINX_PAGESPEED_FILE | sed "s/v//" | sed "s/-beta.tar.gz//") | |
OPENSSL_FILE=$(wget -O- https://www.openssl.org/source | egrep -o 'openssl-[a-z0-9\-\.]+.tar.gz' | sort -V | tail -1) | |
cd target | |
rm -rf tmp | |
mkdir tmp | |
if [ -d nginx ]; | |
then | |
echo "[INFO] NGinx archive already downloaded." | |
else | |
mkdir nginx | |
wget -O - http://nginx.org/download/$NGINX_FILE | tar -C ./nginx --strip-components=1 -zxv | |
fi | |
if [ -d nginx-rtmp-module ]; | |
then | |
echo "[INFO] NGinx RTMP archive already downloaded." | |
else | |
mkdir nginx-rtmp-module | |
#wget -t 30 -w 5 --waitretry 20 --random-wait -O - https://github.com/arut/nginx-rtmp-module/archive/$NGINX_RTMP_FILE | tar -C ./nginx-rtmp-module --strip-components=1 -zxv | |
#echo "[WARN] Cloning Nginx RTMP module repository from: https://github.com/arut/nginx-rtmp-module.git" | |
#git clone https://github.com/arut/nginx-rtmp-module.git | |
echo "[WARN] Cloning temporary Nginx RTMP module repository from (fixes >>signal 11<< issue): https://github.com/nxtreaming/nginx-rtmp-module.git" | |
git clone https://github.com/nxtreaming/nginx-rtmp-module.git | |
fi | |
if [ -d openssl ]; | |
then | |
echo "[INFO] OpenSSL archive already downloaded." | |
else | |
mkdir openssl | |
wget -t 30 -w 5 --waitretry 20 --random-wait -O - https://www.openssl.org/source/$OPENSSL_FILE | tar -C ./openssl --strip-components=1 -zxv | |
fi | |
if [ -d ngx_pagespeed ]; | |
then | |
echo "[INFO] NGinx Pagespeed archive already downloaded." | |
else | |
mkdir -p ngx_pagespeed/psol | |
wget -t 30 -w 5 --waitretry 20 --random-wait -O - https://github.com/pagespeed/ngx_pagespeed/archive/$NGINX_PAGESPEED_FILE | tar -C ./ngx_pagespeed --strip-components=1 -zxv | |
wget -t 30 -w 5 --waitretry 20 --random-wait -O - https://dl.google.com/dl/page-speed/psol/$NGINX_PAGESPEED_VERSION.tar.gz | tar -C ./ngx_pagespeed/psol --strip-components=1 -zxv | |
fi | |
if [ -d ngx_http_geoip2_module ]; | |
then | |
echo "NGinx GeoIP2 module already checked out." | |
else | |
git clone https://github.com/leev/ngx_http_geoip2_module.git | |
mkdir libmaxminddb | |
LIB_MAXMIND_VERSION=$(wget -O- https://github.com/maxmind/libmaxminddb/releases | egrep -o 'download/[0-9\-\.]+' | sed "s/download\///" | sort -V | tail -1) | |
wget -O - https://github.com/maxmind/libmaxminddb/releases/download/$LIB_MAXMIND_VERSION/libmaxminddb-$LIB_MAXMIND_VERSION.tar.gz | tar -C ./libmaxminddb --strip-components=1 -zxv | |
cd libmaxminddb | |
./configure | |
make | |
cd .. | |
fi | |
if [ -f nginx/objs/nginx ]; | |
then | |
echo "NGinx already compiled." | |
else | |
cd nginx | |
# NOTE: config script cannot detect the architecture | |
export PSOL_BINARY=../ngx_pagespeed/psol/lib/Release/linux/x64/pagespeed_automatic.a | |
# NOTE: wtf, pagespeed has to be configured after geoip2; otherwise cannot detect libmaxmind | |
#./configure --add-module=../nginx-rtmp-module --add-module=../ngx_http_geoip2_module --add-module=../ngx_pagespeed --with-http_stub_status_module --with-http_addition_module --with-http_sub_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_spdy_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl --with-http_ssl_module --with-google_perftools_module --with-http_xslt_module --with-http_random_index_module --with-http_secure_link_module --with-pcre-jit --with-file-aio --with-ipv6 --with-cc-opt="-I ../libmaxminddb/include -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic" --with-ld-opt="-L ../libmaxminddb/src/.libs" | |
# NOTE: nxtreaming test | |
./configure --with-debug --with-openssl=../openssl --with-http_ssl_module --with-http_spdy_module --with-http_flv_module --with-http_mp4_module --add-module=../nginx-rtmp-module | |
make | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment