Current File : /home/inlingua/public_html/decay_sym/root/var/softaculous/apps/apache2/build/make.sh |
#!/bin/bash
source /var/softaculous/apps/build/common.sh
#Version
APACHE2=httpd-2.4.65
APACHE2_LSAPI=mod_lsapi-1.1-68 # https://repo.cloudlinux.com/cloudlinux/sources/da/
APACHE2_HOSTINGLIMITS=mod_hostinglimits-1.0-41 # https://repo.cloudlinux.com/cloudlinux/sources/da/
APACHEdeps=httpd-2.4.25-deps
modsecurity=2.9.7
modsecurity3=3.0.8
modsecurity_apache=modsecurity-$modsecurity
modsecurity3_apache=modsecurity-v$modsecurity3
version_mod=v$modsecurity
version_mod3=v$modsecurity3
mod_proxy_html=mod_proxy_html
mod_fcgid=mod_fcgid-2.3.9 #https://httpd.apache.org/download.cgi#mod_fcgid
APR=apr-1.7.6
APR_UTIL=apr-util-1.6.3
suphp_version=suphp-0.8.0-pre
suphp=mod_suphp
#PATH
PATH_APACHE2=$AMPPS_PATH/apache2
apache2(){
# Libraries
#openssl
#zlib
# For nghttp2, library should be installed on the compiling machine using the following steps
#cd $SRC_PATH
#tar -zxvf nghttp2-1.20.0.tar.gz
#cd nghttp2-1.20.0
#./configure --prefix=$AMPPS_PATH --enable-lib-only && make && make install
# apt-get install libtool pkg-config (not required if downloading tar instead of source)
# autoreconf -i --force (not required if downloading tar instead of source)
# automake (not required if downloading tar instead of source)
# autoconf (not required if downloading tar instead of source)
is_file $PATH_APACHE2/bin/httpd
if [ $? == 0 ]
then
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "Installing Apache2"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
cd $SRC_PATH
#tar -jxf apr-1.6.2.tar.bz2
#tar -jxf apr-util-1.6.0.tar.bz2
#tar -zxf $APACHEdeps.tar.gz
remove_dir $APACHE2
remove_dir $APACHEdeps
is_file $APACHE2.tar.gz
if [ $? == 0 ]
then
banner $APACHE2".tar.gz Downloading"
wget --no-check-certificate -O $SRC_PATH/$APACHE2.tar.gz https://archive.apache.org/dist/httpd/$APACHE2.tar.gz >> $LOG 2>&1
fi
tar -zxf $APACHE2.tar.gz
#mv /setups/src/httpd-2.4.25/srclib/* /setups/src/httpd-2.4.28/srclib/
#cd $APACHE2/srclib/
cd $SRC_PATH
is_file $APR.tar.bz2
if [ $? == 0 ]
then
banner $APR".tar.bz2 Downloading"
wget --no-check-certificate -O $SRC_PATH/$APR.tar.bz2 https://downloads.apache.org/apr/$APR.tar.bz2 >> $LOG 2>&1
fi
cd $APACHE2/srclib/
tar -jxf $SRC_PATH/$APR.tar.bz2
mv $SRC_PATH/$APACHE2/srclib/$APR $SRC_PATH/$APACHE2/srclib/apr
cd $SRC_PATH
is_file $APR_UTIL.tar.bz2
if [ $? == 0 ]
then
banner $APR_UTIL".tar.bz2 Downloading"
wget --no-check-certificate -O $SRC_PATH/$APR_UTIL.tar.bz2 https://downloads.apache.org/apr/$APR_UTIL.tar.bz2 >> $LOG 2>&1
fi
cd $APACHE2/srclib/
tar -jxf $SRC_PATH/$APR_UTIL.tar.bz2
mv $SRC_PATH/$APACHE2/srclib/$APR_UTIL $SRC_PATH/$APACHE2/srclib/apr-util
cd $SRC_PATH/$APACHE2
MOD_XML2ENC_LDADD="-L$AMPPS_PATH/lib -R$AMPPS_PATH/lib" MOD_PROXY_HTML_LDADD="-L$AMPPS_PATH/lib -R$AMPPS_PATH/lib"
MOD_SSL_LDADD="-L$AMPPS_PATH/openssl-30/lib -R$AMPPS_PATH/openssl-30/lib"
export MOD_XML2ENC_LDADD
export MOD_PROXY_HTML_LDADD
export MOD_SSL_LDADD
export PKG_CONFIG_PATH=/usr/local/apps/liblzma/lib/pkgconfig
LDFLAGS="-L$AMPPS_PATH/lib" CPPFLAGS="-I$AMPPS_PATH/include" ./configure --prefix=$PATH_APACHE2 \
--sysconfdir=$PATH_APACHE2/etc \
--with-expat=$AMPPS_PATH \
--with-included-apr \
--with-apr=/usr/local/apps/apache2/bin/apr-1-config \
--with-apr-util=/usr/local/apps/apache2/bin/apu-1-config \
--datadir=$PATH_APACHE2/www \
--enable-mods-shared="all ssl cache proxy authn_alias mem_cache file_cache charset_lite dav_lock disk_cache deflate" \
--enable-proxy-html \
--enable-xml2enc \
--with-libxml2=$AMPPS_PATH/include/libxml2/ \
--with-mpm=prefork \
--enable-mpms-shared=all \
--with-pcre=$AMPPS_PATH/bin/pcre-config \
--with-z=$AMPPS_PATH \
--with-ssl=$AMPPS_PATH/openssl-30 \
--with-openssl=shared,$AMPPS_PATH/openssl-30 \
--with-openssl-dir=$AMPPS_PATH/openssl-30 \
--enable-cgi \
--enable-cgid \
--enable-http2 \
--with-nghttp2=$AMPPS_PATH/lib \
--enable-ssl \
--enable-remoteip\
--enable-suexec \
--enable-brotli \
--with-brotli=$AMPPS_PATH/brotli \
LDFLAGS=-Wl,-rpath=$AMPPS_PATH/openssl-30/lib:$AMPPS_PATH/brotli/lib:$AMPPS_PATH/lib && make && make install >> $LOG 2>&1
#--with-nghttp2=$AMPPS_PATH/lib \
#--with-expat=$AMPPS_PATH/lib \
#--enable-mods-shared="all ssl cache proxy authn_alias mem_cache file_cache charset_lite dav_lock disk_cache deflate http2" \
fi
is_file $PATH_APACHE2/bin/httpd
if [ $? == 0 ]
then
banner 'Apache2 could not be installed due to some reason'
exit 1
fi
apache2_modsecurity
chmod 0755 $PATH_APACHE2/modules/mod_security2.so
# Delete the conf
rm -rf $PATH_APACHE2/etc/httpd.conf
rm -rf $PATH_APACHE2/bin/apachectl2
cp $APPS_PATH/apache2/build/src/bin/apachectl2 $PATH_APACHE2/bin/apachectl
chmod 0755 $PATH_APACHE2/bin/apachectl
# Extra conf dir
mkdir $PATH_APACHE2/etc/conf.d
#is_file $PATH_APACHE/modules/mod_fastcgi.so
#if [ $? == 0 ]
#then
# echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
# echo "Installing Apache fastcgi"
# echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
# cd $SRC_PATH
# tar -zxf $mod_fastcgi.tar.gz
# cd $mod_fastcgi/mod_fastcgi
# cp -Rf $SETUPS/mods/Makefile.AP2 $SRC_PATH/$mod_fastcgi/mod_fastcgi/Makefile
# make
# make install
#fi
#
#is_file $PATH_APACHE/modules/mod_fastcgi.so
#if [ $? == 0 ]
#then
# banner 'Apache fastcgi could not be installed due to some reason'
# exit 1
#fi
}
apache2_fcgid(){
is_file $PATH_APACHE2/modules/mod_fcgid.so
if [ $? == 0 ]
then
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "Installing Apache mod_fcgid"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
cd $SRC_PATH
is_file $mod_fcgid.tar.gz
if [ $? == 0 ]
then
wget --no-check-certificate https://dlcdn.apache.org/httpd/mod_fcgid/$mod_fcgid.tar.gz>> $LOG 2>&1
fi
tar -zxf $mod_fcgid.tar.gz
cd $mod_fcgid
APXS=$PATH_APACHE2/bin/apxs ./configure.apxs
make
make install
fi
is_file $PATH_APACHE2/modules/mod_fcgid.so
if [ $? == 0 ]
then
banner 'Apache mod_fcgid could not be installed due to some reason'
exit 1
fi
}
apache2_pagespeed(){
is_file $PATH_APACHE2/modules/mod_pagespeed_ap24.so
if [ $? == 0 ]
then
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "Installing Apache mod_pagespeed_ap24"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
cd $SRC_PATH
cd incubator-pagespeed-mod
is_file /setups/incubator-pagespeed-mod/out/Release/libmod_pagespeed_ap24.so
if [ $? == 0 ]
then
cd $SRC_PATH
rm -rf incubator-pagespeed-mod
git clone -b latest-stable --recursive https://github.com/apache/incubator-pagespeed-mod.git --depth=1
cd incubator-pagespeed-mod
python build/gyp_chromium --depth=.
cp -r $SRC_PATH/$APACHE2/srclib/apr/* /setups/incubator-pagespeed-mod/third_party/apr/src
cp -r $SRC_PATH/$APACHE2/srclib/apr-util/* /setups/incubator-pagespeed-mod/third_party/aprutil/src
mkdir -p /setups/incubator-pagespeed-mod/third_party/apr/src/include/uuid/
cp -r /usr/local/apps/include/uuid/* /setups/incubator-pagespeed-mod/third_party/apr/src/include/uuid/
export LD_LIBRARY_PATH=/usr/local/apps/lib:$LD_LIBRARY_PATH
make BUILDTYPE=Release LDFLAGS_Release="-L/usr/local/apps/lib/ -luuid -lintl" LIBS="/usr/lib64/libpthread.so.0"
fi
cp /var/softaculous/apps/apache2/build/src/bin/httpd1.conf /usr/local/apps/apache2/etc/httpd.conf
APXS_BIN=/usr/local/apps/apache2/bin/apxs ./install/install_apxs.sh
# echo "n"| APXS_BIN=/usr/local/apps/apache2/bin/apxs ./install/install_apxs.sh
rm -rf $PATH_APACHE2/etc/httpd.conf
fi
is_file $PATH_APACHE2/modules/mod_pagespeed_ap24.so
if [ $? == 0 ]
then
banner 'Apache mod_pagespeed_ap24.so could not be installed due to some reason'
exit 1
fi
}
apache2_lsapi(){
is_file $PATH_APACHE2/modules/mod_lsapi.so
if [ $? == 0 ]
then
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "Installing Apache mod_lsapi"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
cd $SRC_PATH
is_file $APACHE2_LSAPI.tar.gz
if [ $? == 0 ]
then
wget --no-check-certificate https://repo.cloudlinux.com/cloudlinux/sources/da/$APACHE2_LSAPI.tar.gz >> $LOG 2>&1
fi
tar -zxf $APACHE2_LSAPI.tar.gz
cd $APACHE2_LSAPI
$PATH_APACHE2/bin/apxs -I $SRC_PATH/$APACHE2_LSAPI/src/include -I $SRC_PATH/$APACHE2_LSAPI/src/liblscapi-util -i -a -c $SRC_PATH/$APACHE2_LSAPI/src/mod_lsapi/mod_lsapi.c
fi
is_file $PATH_APACHE2/modules/mod_lsapi.so
if [ $? == 0 ]
then
banner 'Apache mod_lsapi could not be installed due to some reason'
exit 1
fi
}
apache2_hostinglimits(){
is_file $PATH_APACHE2/modules/mod_hostinglimits.so
if [ $? == 0 ]
then
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "Installing Apache mod_hostinglimits"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
cd $SRC_PATH
is_file $APACHE2_HOSTINGLIMITS.tar.gz
if [ $? == 0 ]
then
wget --no-check-certificate https://repo.cloudlinux.com/cloudlinux/sources/da/$APACHE2_HOSTINGLIMITS.tar.gz >> $LOG 2>&1
fi
tar -zxf $APACHE2_HOSTINGLIMITS.tar.gz
cd $APACHE2_HOSTINGLIMITS
mkdir builds
cd builds
cmake .. -LH -DAPACHE_INCLUDES_DIR=/usr/local/apps/apache2/include/ -DAPACHE_LIBRARIES_DIR=/usr/local/apps/apache2/lib/ -DAPRUTIL_INCLUDE_DIR=/usr/local/apps/apache2/include/ -DAPRUTIL_LIBRARY=/usr/local/apps/apache2/lib/ -DAPR_INCLUDE_DIR=/usr/local/apps/apache2/include/ -DAPR_LIBRARY=/usr/local/apps/apache2/lib/ -DCMAKE_INSTALL_PREFIX:path=/usr/local/apps/apache2/ -DHTTPD_BIN:PATH=/usr/local/apps/apache2/bin/ -DHTTPD_PRG=/usr/local/apps/apache2/bin/httpd
make
make install
cp /etc/httpd/modules/mod_hostinglimits.so /usr/local/apps/apache2/modules/
fi
is_file $PATH_APACHE2/modules/mod_hostinglimits.so
if [ $? == 0 ]
then
banner 'Apache mod_hostinglimits could not be installed due to some reason'
exit 1
fi
}
apache2_modsecurity(){
is_file $PATH_APACHE2"/lib/mod_security2.so"
if [ $? == 0 ]
then
#apache
banner "Installing modsecurity for apache "
cd $SRC_PATH
remove_dir $modsecurity_apache
if [ $? == 0 ]
then
banner $modsecurity_apache".tar.bz2 Downloading"
wget --no-check-certificate -O $SRC_PATH/$modsecurity_apache.tar.gz https://github.com/SpiderLabs/ModSecurity/releases/download/$version_mod/$modsecurity_apache.tar.gz >> $LOG 2>&1
fi
tar -zxf $modsecurity_apache.tar.gz
cd $modsecurity_apache
PCRE_LIB="-L$AMPPS_PATH/lib -lpcre" PCRECONFIG="$AMPPS_PATH/bin/pcre-config" LDFLAGS="-L$AMPPS_PATH/lib -L/usr/local/apps/apache2/lib" CPPFLAGS="-I$AMPPS_PATH/include" ./configure --prefix=$PATH_APACHE2 --with-apxs=$PATH_APACHE2/bin/apxs --with-curl=$AMPPS_PATH/curl-7 --with-pcre=$AMPPS_PATH --with-libxml=$AMPPS_PATH --with-apr=$PATH_APACHE2/bin/apr-1-config --with-apu=$PATH_APACHE2/bin/apu-1-config LDFLAGS=-Wl,-rpath=$AMPPS_PATH/curl-7/lib:$AMPPS_PATH/lib && make && make install
fi
is_file $PATH_APACHE2"/lib/mod_security2.so"
if [ $? == 0 ]
then
banner 'Apache2 Modsecurity could not compile due to some reason'
exit 1
fi
}
apache2_modsecurity3(){
is_file $PATH_APACHE2"/lib/libmodsecurity.so.3"
if [ $? == 0 ]
then
#apache
banner "Installing modsecurity3 for apache "
cd $SRC_PATH
remove_dir $modsecurity3_apache
if [ $? == 0 ]
then
banner $modsecurity3_apache".tar.bz2 Downloading"
wget --no-check-certificate -O $SRC_PATH/$modsecurity3_apache.tar.gz https://github.com/SpiderLabs/ModSecurity/releases/download/$version_mod3/$modsecurity3_apache.tar.gz >> $LOG 2>&1
https://github.com/SpiderLabs/ModSecurity/releases/download/v3.0.8/modsecurity-v3.0.8.tar.gz
fi
tar -zxf $modsecurity3_apache.tar.gz
cd $modsecurity3_apache
PCRE_LIB="-L$AMPPS_PATH/lib -lpcre" PCRECONFIG="$AMPPS_PATH/bin/pcre-config" LDFLAGS="-L$AMPPS_PATH/lib -L/usr/local/apps/apache2/lib" CPPFLAGS="-I$AMPPS_PATH/include" ./configure --prefix=$PATH_APACHE2 --with-curl=$AMPPS_PATH/curl-7 --with-pcre=$AMPPS_PATH --with-libxml=$AMPPS_PATH LDFLAGS=-Wl,-rpath=$AMPPS_PATH/curl-7/lib:$AMPPS_PATH/lib && make && make install
#--with-apxs=$PATH_APACHE2/bin/apxs
#--with-apr=$PATH_APACHE2/bin/apr-1-config
#--with-apu=$PATH_APACHE2/bin/apu-1-config
#---------------------------------------------------------------------------------
cd $SRC_PATH
remove_dir $modsecurity3_apache
if [ $? == 0 ]
then
banner $modsecurity3_apache".tar.bz2 Downloading"
wget --no-check-certificate -O $SRC_PATH/$modsecurity3_apache.tar.gz https://github.com/SpiderLabs/ModSecurity/releases/download/$version_mod3/$modsecurity3_apache.tar.gz >> $LOG 2>&1
https://github.com/SpiderLabs/ModSecurity/releases/download/v3.0.8/modsecurity-v3.0.8.tar.gz
fi
https://codeload.github.com/SpiderLabs/ModSecurity-apache/zip/refs/heads/master
unzip ModSecurity-apache-master.zip
cd ModSecurity-apache-master
./autogen.sh
PCRE_LIB="-L$AMPPS_PATH/lib -lpcre" PCRECONFIG="$AMPPS_PATH/bin/pcre-config" LDFLAGS="-L$AMPPS_PATH/lib -L/usr/local/apps/apache2/lib" CPPFLAGS="-I$AMPPS_PATH/include" ./configure --prefix=$PATH_APACHE2 --with-apxs=$PATH_APACHE2/bin/apxs --with-curl=$AMPPS_PATH --with-pcre=$AMPPS_PATH --with-libxml=$AMPPS_PATH --with-apr=$PATH_APACHE2/bin/apr-1-config --with-apu=$PATH_APACHE2/bin/apu-1-config --with-apache=$PATH_APACHE2/bin/httpd --with-libmodsecurity=$PATH_APACHE2 && make && make install
#---------------------------------------------------------------------------------
fi
is_file $PATH_APACHE2"/lib/libmodsecurity.so.3"
if [ $? == 0 ]
then
banner 'Apache2 Modsecurity3 could not compile due to some reason'
exit 1
fi
}
apache2_suphp(){
is_file $PATH_APACHE2/modules/mod_suphp.so
if [ $? == 0 ]
then
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "Installing Apache mod_suphp"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
cd $SRC_PATH
remove_dir $suphp
git clone -b master https://github.com/lightsey/mod_suphp.git
cd $suphp
/usr/local/apps/bin/libtoolize --force
aclocal
autoheader
automake --force-missing --add-missing
autoconf
./configure --prefix=/usr/local/apps/apache2/ --with-apr=/usr/local/apps/apache2/bin/apr-1-config --with-apxs=/usr/local/apps/apache2/bin/apxs && make && make install >> $LOG 2>&1
fi
is_file $PATH_APACHE2/modules/mod_suphp.so
if [ $? == 0 ]
then
banner 'Apache mod suphp could not be installed due to some reason'
exit 1
fi
}
apache2_evasive(){
is_file $PATH_APACHE2/modules/mod_evasive20.so
if [ $? == 0 ]
then
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "Installing Apache mod_evasive24"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
cd $SRC_PATH
is_file mod_evasive-master.zip
if [ $? == 0 ]
then
wget --no-check-certificate -o $SRC_PATH/mod_evasive-master.zip https://github.com/shivaas/mod_evasive/archive/refs/heads/master.zip >> $LOG 2>&1
fi
unzip -o mod_evasive-master.zip
cd mod_evasive-master
$PATH_APACHE2/bin/apxs -i -a -c $SRC_PATH/mod_evasive-master/mod_evasive24.c
fi
mv $PATH_APACHE2/modules/mod_evasive24.so $PATH_APACHE2/modules/mod_evasive20.so
is_file $PATH_APACHE2/modules/mod_evasive20.so
if [ $? == 0 ]
then
banner 'Apache mod_evasive could not be installed due to some reason'
exit 1
fi
}
apache2
apache2_fcgid
apache2_pagespeed
apache2_suphp
apache2_evasive
sudo chown -R root:root /usr/local/apps/apache2/www/
sudo chown -R root:root /usr/local/apps/apache2/man/