Current File : /home/inlingua/public_html/decay_sym/root/var/softaculous/apps/nginx/build/make.sh |
#!/bin/bash
source /var/softaculous/apps/build/common.sh
NGINX=nginx-1.28.0 # https://nginx.org/en/download.html
PATH_NGINX=$AMPPS_PATH/nginx
OPENSSL=openssl-3.0.7
version=3.0.7
ZLIB=zlib-1.2.11
pcre=pcre-8.37
thisuser=emps
modsecurity_apache=modsecurity-v3.0.9 # For nginx
NPS_VERSION=1.12.34.3-stable
version_mod=3.0.9
ngx_Rtmp() {
#pcre
is_dir $SRC_PATH/nginx-rtmp-module
if [ $? == 1 ]
then
echo "Removing old NGINX-RTMP Module directory"
rm -rf $SRC_PATH/nginx-rtmp-module
fi
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "Downloading Nginx-Rtmp Module"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
cd $SRC_PATH
is_dir $SRC_PATH/nginx-rtmp-module
if [ $? == 0 ]
then
git clone https://github.com/arut/nginx-rtmp-module.git
fi
is_dir $SRC_PATH/nginx-rtmp-module
if [ $? == 0 ]
then
git clone https://github.com/arut/nginx-rtmp-module.git
fi
is_dir $SRC_PATH/nginx-rtmp-module
if [ $? == 0 ]
then
echo "Nginx-Rtmp Module could not be installed due to some reason"
fi
}
ngx_sxg() {
is_dir $SRC_PATH/nginx-sxg-module
if [ $? == 1 ]
then
echo "Removing old NGINX-SXG Module directory"
rm -rf $SRC_PATH/nginx-sxg-module
fi
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "Downloading Nginx-SXG Module"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
cd $SRC_PATH
is_dir $SRC_PATH/nginx-sxg-module
if [ $? == 0 ]
then
git clone https://github.com/google/nginx-sxg-module
fi
is_dir $SRC_PATH/nginx-sxg-module
if [ $? == 0 ]
then
echo "Nginx-SXG Module could not be installed due to some reason"
fi
}
ngx_ModSec3(){
is_file $PATH_NGINX/lib/libmodsecurity.so.3
if [ $? == 0 ]
then
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "Installing ModSecurity-nginx Module"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
cd $SRC_PATH
is_dir $SRC_PATH/ModSecurity-nginx
if [ $? == 0 ]
then
git clone https://github.com/SpiderLabs/ModSecurity-nginx.git
fi
is_dir $SRC_PATH/ModSecurity-nginx
if [ $? == 0 ]
then
git clone https://github.com/SpiderLabs/ModSecurity-nginx.git
fi
is_file $modsecurity_apache.tar.gz
if [ $? == 0 ]
then
banner $modsecurity_apache".tar.gz Downloading"
wget --no-check-certificate -O $SRC_PATH/$modsecurity_apache.tar.gz https://github.com/SpiderLabs/ModSecurity/releases/download/v$version_mod/$modsecurity_apache.tar.gz >> $LOG 2>&1
fi
# To install Modsecurity library
tar -zxf $modsecurity_apache.tar.gz
cd $modsecurity_apache
#
LDFLAGS="-L$AMPPS_PATH/lib" CPPFLAGS="-I$AMPPS_PATH/include" ./configure --prefix=$AMPPS_PATH/nginx --with-pcre=$AMPPS_PATH --with-libxml=$AMPPS_PATH --with-curl=$AMPPS_PATH/curl-7 --with-geoip=$AMPPS_PATH/geoip && make && make install >> $LOG 2>&1
#sed -i 's/static char auditlog_lock_name/\/\/static char auditlog_lock_name/g' apache2/modsecurity.h
#sed -i 's/static char geo_lock_name/\/\/static char geo_lock_name/g' apache2/modsecurity.h
fi
is_file $PATH_NGINX/lib/libmodsecurity.so.3
if [ $? == 0 ]
then
echo "ModSecurity-nginx Module could not be installed due to some reason"
exit 1
fi
}
nginx() {
# Libraries
#openssl
#zlib
#pcre
#ngx_pagespeed
remove_dir $NGINX
is_file $PATH_NGINX/sbin/nginx
if [ $? == 0 ]
then
ngx_Rtmp
#ngx_sxg
ngx_ModSec3
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "Installing Nginx"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
cd $SRC_PATH
is_file $OPENSSL.tar.gz
if [ $? == 0 ]
then
banner $OPENSSL".tar.gz Downloading"
wget --no-check-certificate -O $SRC_PATH/$OPENSSL.tar.gz https://ftp.openssl.org/source/old/$version/$OPENSSL.tar.gz >> $LOG 2>&1
fi
tar -zxf $OPENSSL.tar.gz
is_file $ZLIB.tar.gz
if [ $? == 0 ]
then
banner $ZLIB".tar.gz Downloading"
wget --no-check-certificate -O $SRC_PATH/$ZLIB.tar.gz https://sourceforge.net/projects/libpng/files/zlib/1.2.11/$ZLIB.tar.gz/download >> $LOG 2>&1
fi
tar -zxf $ZLIB.tar.gz
is_file $pcre.tar.gz
if [ $? == 0 ]
then
banner $pcre".tar.gz Downloading"
wget --no-check-certificate -O $SRC_PATH/$pcre.tar.gz https://ftp.exim.org/pub/pcre/$pcre.tar.gz >> $LOG 2>&1
fi
tar -zxf $pcre.tar.gz
is_file $NGINX.tar.gz
if [ $? == 0 ]
then
banner $NGINX".tar.gz Downloading"
wget --no-check-certificate -O $SRC_PATH/$NGINX.tar.gz https://nginx.org/download/$NGINX.tar.gz >> $LOG 2>&1
fi
tar -zxf $NGINX.tar.gz
cd $NGINX
ldconfig
export MODSECURITY_LIB="/usr/local/apps/nginx/lib/"
export MODSECURITY_INC="/usr/local/apps/nginx/include/"
export LD_LIBRARY_PATH=/usr/local/apps/quictls/lib:$LD_LIBRARY_PATH
#LDFLAGS="-L$AMPPS_PATH/lib -lssl -lcrypto" CPPFLAGS="-I$AMPPS_PATH/include" ./configure
LDFLAGS="-L/usr/local/apps/libsxg/lib -L$AMPPS_PATH/lib -L/usr/local/apps/quictls/lib -lssl -lcrypto" \
CPPFLAGS="-I$AMPPS_PATH/include -I$AMPPS_PATH/libsxg/include -I/usr/local/apps/quictls/include" \
./configure \
--prefix=$PATH_NGINX/etc \
--sbin-path=$PATH_NGINX/sbin/nginx \
--conf-path=$PATH_NGINX/etc/nginx.conf \
--error-log-path=$PATH_NGINX/var/log/error.log \
--http-log-path=$PATH_NGINX/var/log/access.log \
--pid-path=$PATH_NGINX/var/run/nginx.pid \
--lock-path=$PATH_NGINX/var/run/nginx.lock \
--http-client-body-temp-path=$PATH_NGINX/var/cache/client_temp \
--http-proxy-temp-path=$PATH_NGINX/var/cache/proxy_temp \
--http-fastcgi-temp-path=$PATH_NGINX/var/cache/fastcgi_temp \
--http-uwsgi-temp-path=$PATH_NGINX/var/cache/uwsgi_temp \
--http-scgi-temp-path=$PATH_NGINX/var/cache/scgi_temp \
--user=$thisuser \
--group=$thisuser \
--with-zlib=$SRC_PATH/$ZLIB \
--with-pcre=$SRC_PATH/$pcre \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_v2_module \
--with-http_v3_module \
--with-openssl=$SRC_PATH/openssl-openssl-3.3.0-quic1 \
--with-cc-opt="-I/usr/local/apps/quictls/include" \
--with-ld-opt="-L/usr/local/apps/quictls/lib" \
--with-mail_ssl_module \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--with-file-aio \
--with-stream \
--with-stream_realip_module \
--add-dynamic-module=$SRC_PATH/ModSecurity-nginx \
--add-module=$SRC_PATH/nginx-rtmp-module \
--add-dynamic-module=$SRC_PATH/nginx-sxg-module \
--with-ipv6 && make && make install >> $LOG 2>&1
# --add-module=$SRC_PATH/$modsecurity_apache/nginx/modsecurity \ For Modsecurity 2
# --add-module=$SRC_PATH/incubator-pagespeed-ngx-${NPS_VERSION} \
# --add-module=$SRC_PATH/ngx_pagespeed \
# --with-threads \
# --with-http_spdy_module \ Deprecated from 1.9.5
# --add-module=$SRC_PATH/ngx_pagespeed-release-$NPS_VERSION-beta \
# --with-mail=dynamic \
# --with-http_spdy_module \
patchelf --set-rpath $AMPPS_PATH/libsxg/lib/:$AMPPS_PATH/quictls/lib/:$AMPPS_PATH/lib/ $AMPPS_PATH/nginx/etc/modules/ngx_http_sxg_filter_module.so
fi
is_file $PATH_NGINX/sbin/nginx
if [ $? == 0 ]
then
banner 'NGINX could not be installed due to some reason'
exit 1
fi
# Make the bin folder
mkdir $PATH_NGINX/bin
chmod 0755 $PATH_NGINX/bin
# Make the var/cache folder
mkdir $PATH_NGINX/var/cache
chmod 0755 $PATH_NGINX/var/cache
rm -rf $PATH_NGINX/bin/nginxctl
cp /var/softaculous/apps/nginx/build/bin/nginxctl $PATH_NGINX/bin
chmod 0755 $PATH_NGINX/bin/nginxctl
}
nginx