2023-06-25 10:16:07 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-04-27 15:38:20 +00:00
|
|
|
while [ ${#} -gt 0 ]; do
|
|
|
|
case "$1" in
|
2024-04-28 16:15:45 +00:00
|
|
|
--no-modsecurity | -nm ) DISABLE_MODSECURITY=true;; # Not include ModSecurity in building
|
|
|
|
--no-lua | -nl ) DISABLE_LUA=true ;; # Not include Lua in building
|
|
|
|
--install | -i ) INSTALL=true ;; # Install Nginx
|
|
|
|
--ssl=* )
|
|
|
|
SSL_LIB="${1#*=}"
|
2024-09-21 07:47:19 +00:00
|
|
|
SSL_LIB="${SSL_LIB,,}"
|
2024-04-28 16:15:45 +00:00
|
|
|
case $SSL_LIB in # Re-define SSL_LIB
|
|
|
|
"quictls") SSL_LIB="quictls" ;;
|
|
|
|
"boringssl") SSL_LIB="boringssl" ;;
|
|
|
|
"libressl") SSL_LIB="libressl" ;;
|
|
|
|
"")
|
|
|
|
echo "ERROR : --ssl= is empty!"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "ERROR : Vaild values for --ssl are -> quictls, boringssl, libressl"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2024-04-27 16:03:14 +00:00
|
|
|
;;
|
2024-09-21 07:47:19 +00:00
|
|
|
--type=* )
|
|
|
|
BUILD_TYPE="${1#*=}"
|
|
|
|
BUILD_TYPE="${BUILD_TYPE,,}"
|
|
|
|
case $BUILD_TYPE in
|
|
|
|
"nginx") BUILD_TYPE="nginx" ;;
|
|
|
|
"freenginx") BUILD_TYPE="freenginx" ;;
|
|
|
|
"")
|
|
|
|
echo "ERROR : --type= is empty!"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "ERROR : Vaild values for --type are -> nginx, freenginx"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2024-07-09 15:35:34 +00:00
|
|
|
--nginx-tag=* )
|
2024-09-21 07:47:19 +00:00
|
|
|
NGINX_TAG="${1#*=}" # Specify Nginx/freenginx Tag
|
2024-07-09 15:35:34 +00:00
|
|
|
case $NGINX_TAG in
|
|
|
|
"")
|
|
|
|
echo "ERROR: --nginx-tag= is empty!"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2024-04-27 15:38:20 +00:00
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2024-04-28 16:15:45 +00:00
|
|
|
# if $SSL_LIB is null/empty
|
|
|
|
SSL_LIB=${SSL_LIB:-"boringssl"}
|
2024-09-21 07:47:19 +00:00
|
|
|
BUILD_TYPE=${BUILD_TYPE:-"nginx"}
|
2023-10-30 19:32:21 +00:00
|
|
|
|
2024-04-28 16:15:45 +00:00
|
|
|
#################################
|
|
|
|
## ##
|
|
|
|
## Dependencies Setup ##
|
|
|
|
## ##
|
|
|
|
#################################
|
2024-03-23 15:15:09 +00:00
|
|
|
|
2024-04-28 16:15:45 +00:00
|
|
|
# Get Dependencies
|
2024-09-22 06:42:55 +00:00
|
|
|
|
|
|
|
# Detect OS
|
2024-10-02 10:54:43 +00:00
|
|
|
os=$(grep '^ID=' /etc/os-release | cut -d'=' -f2)
|
2024-09-22 06:42:55 +00:00
|
|
|
case $os in
|
|
|
|
"debian" | "ubuntu" )
|
|
|
|
sudo apt update
|
|
|
|
sudo apt install -y \
|
|
|
|
mercurial \
|
|
|
|
libunwind-dev \
|
|
|
|
libpcre3 \
|
|
|
|
libpcre3-dev \
|
|
|
|
zlib1g-dev \
|
|
|
|
cmake \
|
|
|
|
make \
|
|
|
|
libxslt1-dev \
|
|
|
|
libgd-dev \
|
|
|
|
libssl-dev \
|
|
|
|
libperl-dev \
|
|
|
|
libgeoip-dev \
|
|
|
|
git \
|
|
|
|
g++ \
|
|
|
|
apt-utils \
|
|
|
|
autoconf \
|
|
|
|
automake \
|
|
|
|
build-essential \
|
|
|
|
libcurl4-openssl-dev \
|
|
|
|
liblmdb-dev \
|
|
|
|
libtool \
|
|
|
|
libxml2-dev \
|
|
|
|
libyajl-dev \
|
|
|
|
pkgconf \
|
|
|
|
wget \
|
|
|
|
ninja-build
|
|
|
|
;;
|
2024-10-02 10:54:43 +00:00
|
|
|
"alpine" )
|
|
|
|
apk update
|
|
|
|
apk add \
|
|
|
|
mercurial \
|
|
|
|
libunwind \
|
|
|
|
pcre-dev \
|
|
|
|
zlib-dev \
|
|
|
|
cmake \
|
|
|
|
make \
|
|
|
|
libxslt-dev \
|
|
|
|
gd-dev \
|
|
|
|
openssl-dev \
|
|
|
|
perl-dev \
|
|
|
|
geoip-dev \
|
|
|
|
git \
|
|
|
|
g++ \
|
|
|
|
build-base \
|
|
|
|
autoconf \
|
|
|
|
automake \
|
|
|
|
curl-dev \
|
|
|
|
lmdb-dev \
|
|
|
|
libtool \
|
|
|
|
libxml2-dev \
|
|
|
|
yajl-dev \
|
|
|
|
pkgconf \
|
|
|
|
wget \
|
|
|
|
ninja \
|
|
|
|
linux-headers \
|
|
|
|
sudo
|
|
|
|
;;
|
2024-09-22 06:42:55 +00:00
|
|
|
* )
|
|
|
|
echo "ERROR: the os detected is not supported. The script will run as is."
|
|
|
|
;;
|
|
|
|
esac
|
2024-03-23 15:15:09 +00:00
|
|
|
|
2024-04-28 16:15:45 +00:00
|
|
|
HOMEDIRECTORY=~/nginx_scriptbox
|
2023-06-25 10:16:07 +00:00
|
|
|
|
2024-04-28 16:15:45 +00:00
|
|
|
# Remove old build directory
|
|
|
|
rm -rf $HOMEDIRECTORY
|
2024-03-23 15:15:09 +00:00
|
|
|
|
2024-04-28 16:15:45 +00:00
|
|
|
mkdir $HOMEDIRECTORY && cd $HOMEDIRECTORY
|
2024-03-23 15:15:09 +00:00
|
|
|
|
2024-09-21 07:47:19 +00:00
|
|
|
#Setup Nginx/freenginx repository
|
|
|
|
case $BUILD_TYPE in
|
|
|
|
"nginx")
|
|
|
|
cd $HOMEDIRECTORY
|
|
|
|
git clone https://github.com/nginx/nginx $HOMEDIRECTORY/nginx
|
|
|
|
cd $HOMEDIRECTORY/nginx
|
|
|
|
|
|
|
|
# Check if the tag exists
|
|
|
|
if [[ -n $NGINX_TAG ]]
|
|
|
|
then
|
|
|
|
if git show-ref $NGINX_TAG --quiet; then
|
|
|
|
echo "INFO: Switching Nginx Branch to ${NGINX_TAG}"
|
|
|
|
git checkout $NGINX_TAG
|
|
|
|
else
|
|
|
|
echo "ERROR: NGINX_TAG specified is not existed. aborting..." && exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
git checkout master
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
"freenginx")
|
|
|
|
cd $HOMEDIRECTORY
|
|
|
|
hg clone https://freenginx.org/hg/nginx $HOMEDIRECTORY/nginx
|
|
|
|
|
|
|
|
cd $HOMEDIRECTORY/nginx
|
|
|
|
# Check if the tag exists
|
|
|
|
if [[ -n $NGINX_TAG ]]
|
|
|
|
then
|
|
|
|
if hg tags | grep -q "^${NGINX_TAG}\>"; then
|
|
|
|
echo "INFO: Switching Nginx Branch to ${NGINX_TAG}"
|
|
|
|
hg checkout $NGINX_TAG
|
|
|
|
else
|
|
|
|
echo "ERROR: NGINX_TAG specified is not existed. aborting..." && exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
hg checkout default
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2024-03-23 15:42:10 +00:00
|
|
|
|
2024-04-28 16:15:45 +00:00
|
|
|
# Build SSL Library
|
|
|
|
case $SSL_LIB in
|
|
|
|
"quictls")
|
|
|
|
git clone --depth=1 https://github.com/quictls/openssl $HOMEDIRECTORY/openssl
|
|
|
|
cd $HOMEDIRECTORY/openssl
|
|
|
|
./Configure --prefix=/opt/quictls
|
|
|
|
make
|
2024-09-21 07:47:19 +00:00
|
|
|
sudo make install
|
|
|
|
sudo mkdir -p /opt/quictls/.openssl
|
|
|
|
sudo cp -r /opt/quictls/include /opt/quictls/.openssl/include
|
|
|
|
sudo cp -r /opt/quictls/lib64 /opt/quictls/.openssl/lib
|
2024-04-28 16:15:45 +00:00
|
|
|
;;
|
|
|
|
"boringssl")
|
|
|
|
# Golang
|
2024-09-22 06:42:55 +00:00
|
|
|
GO_VERSION=1.23.1
|
2024-04-28 16:15:45 +00:00
|
|
|
|
|
|
|
wget https://go.dev/dl/go$GO_VERSION.linux-amd64.tar.gz
|
2024-09-22 06:42:55 +00:00
|
|
|
tar -C $HOMEDIRECTORY -xzf go$GO_VERSION.linux-amd64.tar.gz
|
|
|
|
export PATH=$PATH:$HOMEDIRECTORY/go/bin
|
2024-04-28 16:15:45 +00:00
|
|
|
|
|
|
|
git clone --depth=1 https://github.com/google/boringssl $HOMEDIRECTORY/boringssl
|
|
|
|
cd $HOMEDIRECTORY/boringssl
|
|
|
|
cmake -GNinja -B build
|
|
|
|
ninja -C build
|
|
|
|
;;
|
|
|
|
"libressl")
|
|
|
|
git clone --depth=1 https://github.com/libressl/portable $HOMEDIRECTORY/libressl
|
|
|
|
cd $HOMEDIRECTORY/libressl
|
|
|
|
./autogen.sh
|
|
|
|
./configure
|
|
|
|
cmake -GNinja -B build
|
|
|
|
ninja -C build
|
|
|
|
export DESTDIR=$HOMEDIRECTORY/libressl/libressl-build
|
2024-10-02 10:54:43 +00:00
|
|
|
ninja -C build install
|
2024-04-28 18:37:10 +00:00
|
|
|
export -n DESTDIR # unset to avoid problems with Luajit2/Lua*
|
2024-04-28 16:15:45 +00:00
|
|
|
|
2024-09-21 07:47:19 +00:00
|
|
|
sudo mkdir -p /opt/libressl/.openssl
|
|
|
|
sudo cp -r $HOMEDIRECTORY/libressl/libressl-build/usr/local/include /opt/libressl/.openssl
|
|
|
|
sudo cp -r $HOMEDIRECTORY/libressl/libressl-build/usr/local/lib /opt/libressl/.openssl
|
2024-04-28 16:15:45 +00:00
|
|
|
;;
|
|
|
|
esac
|
2024-04-27 15:38:20 +00:00
|
|
|
|
2024-03-23 15:15:09 +00:00
|
|
|
# ModSecurity
|
2024-04-27 15:38:20 +00:00
|
|
|
if [ ! "${DISABLE_MODSECURITY}" == true ]; then
|
|
|
|
git clone --depth=1 https://github.com/SpiderLabs/ModSecurity $HOMEDIRECTORY/ModSecurity
|
|
|
|
cd $HOMEDIRECTORY/ModSecurity
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
./build.sh
|
|
|
|
./configure
|
|
|
|
make
|
|
|
|
sudo make install
|
|
|
|
fi
|
2023-06-25 10:16:07 +00:00
|
|
|
|
2024-04-28 16:15:45 +00:00
|
|
|
#################################
|
|
|
|
## ##
|
|
|
|
## Nginx Modules ##
|
|
|
|
## ##
|
|
|
|
#################################
|
|
|
|
|
2024-03-23 15:42:10 +00:00
|
|
|
mkdir $HOMEDIRECTORY/nginx/mosc
|
|
|
|
git clone https://github.com/openresty/headers-more-nginx-module $HOMEDIRECTORY/nginx/mosc/headers-more-nginx-module
|
|
|
|
git clone https://github.com/openresty/echo-nginx-module $HOMEDIRECTORY/nginx/mosc/echo-nginx-module
|
2024-03-23 15:15:09 +00:00
|
|
|
|
2024-04-27 15:38:20 +00:00
|
|
|
if [ ! "${DISABLE_MODSECURITY}" == true ]; then
|
|
|
|
git clone https://github.com/SpiderLabs/ModSecurity-nginx $HOMEDIRECTORY/nginx/mosc/ModSecurity-nginx
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! "${DISABLE_LUA}" == true ]; then
|
2024-04-28 07:06:06 +00:00
|
|
|
git clone https://github.com/vision5/ngx_devel_kit $HOMEDIRECTORY/nginx/mosc/ngx_devel_kit
|
2024-04-27 15:38:20 +00:00
|
|
|
git clone https://github.com/openresty/lua-nginx-module $HOMEDIRECTORY/nginx/mosc/lua-nginx-module
|
|
|
|
fi
|
|
|
|
|
2024-03-23 15:15:09 +00:00
|
|
|
# Nginx Module: ngx_brotli
|
2024-03-23 16:03:47 +00:00
|
|
|
git clone --recurse-submodules -j8 https://github.com/google/ngx_brotli $HOMEDIRECTORY/nginx/mosc/ngx_brotli
|
|
|
|
cd $HOMEDIRECTORY/nginx/mosc/ngx_brotli/deps/brotli
|
|
|
|
mkdir out && cd out
|
2024-03-23 15:15:09 +00:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_INSTALL_PREFIX=./installed ..
|
|
|
|
cmake --build . --config Release --target brotlienc
|
|
|
|
|
|
|
|
# Nginx Module: lua-nginx-module, requirement
|
2023-07-20 08:33:56 +00:00
|
|
|
#
|
2024-03-23 15:15:09 +00:00
|
|
|
# lua resty core,lrucache,luajit2
|
|
|
|
|
2024-04-27 15:38:20 +00:00
|
|
|
if [ ! "${DISABLE_LUA}" == true ]; then
|
2024-04-28 18:37:10 +00:00
|
|
|
mkdir -p $HOMEDIRECTORY/nginx-lua && cd $HOMEDIRECTORY/nginx-lua
|
2024-09-21 07:47:19 +00:00
|
|
|
sudo mkdir -p /opt/nginx-lua-module/
|
2024-04-27 15:38:20 +00:00
|
|
|
git clone https://github.com/openresty/lua-resty-core $HOMEDIRECTORY/nginx-lua/lua-resty-core
|
|
|
|
git clone https://github.com/openresty/lua-resty-lrucache $HOMEDIRECTORY/nginx-lua/lua-resty-lrucache
|
|
|
|
git clone https://github.com/openresty/luajit2 $HOMEDIRECTORY/nginx-lua/luajit2
|
|
|
|
git clone https://github.com/openresty/lua-resty-string $HOMEDIRECTORY/nginx-lua/lua-resty-string
|
2024-03-23 15:15:09 +00:00
|
|
|
|
2024-09-04 23:00:06 +00:00
|
|
|
cd $HOMEDIRECTORY/nginx-lua/luajit2 && make && sudo make install PREFIX=/opt/nginx-lua-module/luajit2
|
|
|
|
cd $HOMEDIRECTORY/nginx-lua/lua-resty-core && sudo make install PREFIX=/usr/local/lua LUA_LIB_DIR=/usr/local/lua
|
|
|
|
cd $HOMEDIRECTORY/nginx-lua/lua-resty-lrucache && sudo make install PREFIX=/usr/local/lua LUA_LIB_DIR=/usr/local/lua
|
|
|
|
cd $HOMEDIRECTORY/nginx-lua/lua-resty-string && sudo make install PREFIX=/usr/local/lua LUA_LIB_DIR=/usr/local/lua
|
2024-03-23 15:15:09 +00:00
|
|
|
|
2024-04-27 15:38:20 +00:00
|
|
|
export LUAJIT_LIB=/opt/nginx-lua-module/luajit2/lib
|
|
|
|
export LUAJIT_INC=/opt/nginx-lua-module/luajit2/include/luajit-2.1
|
|
|
|
fi
|
2023-07-20 08:10:07 +00:00
|
|
|
|
2024-04-28 16:15:45 +00:00
|
|
|
######################################################################
|
|
|
|
## ##
|
|
|
|
## Build Nginx ##
|
|
|
|
## ##
|
|
|
|
## Why "--with-cc=c++"? ##
|
|
|
|
## see -> https://trac.nginx.org/nginx/ticket/2605#comment:8 ##
|
|
|
|
## ##
|
|
|
|
######################################################################
|
2024-03-23 15:15:09 +00:00
|
|
|
|
2024-04-27 15:38:20 +00:00
|
|
|
NGINX_CONFIG_PARAMS=(
|
|
|
|
--with-cc=c++
|
|
|
|
--prefix=/usr/share/nginx
|
|
|
|
--conf-path=/etc/nginx/nginx.conf
|
|
|
|
--http-log-path=/var/log/nginx/access.log
|
|
|
|
--error-log-path=/var/log/nginx/error.log
|
|
|
|
--lock-path=/var/lock/nginx.lock
|
|
|
|
--pid-path=/run/nginx.pid
|
|
|
|
--modules-path=/usr/lib/nginx/modules
|
|
|
|
--http-client-body-temp-path=/var/lib/nginx/body
|
|
|
|
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
|
|
|
|
--http-proxy-temp-path=/var/lib/nginx/proxy
|
|
|
|
--http-scgi-temp-path=/var/lib/nginx/scgi
|
|
|
|
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi
|
|
|
|
--with-compat
|
|
|
|
--with-debug
|
|
|
|
--with-pcre-jit
|
|
|
|
--with-http_ssl_module
|
|
|
|
--with-http_stub_status_module
|
|
|
|
--with-http_realip_module
|
|
|
|
--with-http_auth_request_module
|
|
|
|
--with-http_v2_module
|
|
|
|
--with-http_v3_module
|
|
|
|
--with-http_dav_module
|
|
|
|
--with-http_slice_module
|
|
|
|
--with-threads
|
|
|
|
--with-http_addition_module
|
|
|
|
--with-http_flv_module
|
|
|
|
--with-http_gunzip_module
|
|
|
|
--with-http_gzip_static_module
|
|
|
|
--with-http_image_filter_module=dynamic
|
|
|
|
--with-http_mp4_module
|
|
|
|
--with-http_perl_module=dynamic
|
|
|
|
--with-http_random_index_module
|
|
|
|
--with-http_secure_link_module
|
|
|
|
--with-http_sub_module
|
|
|
|
--with-http_xslt_module=dynamic
|
|
|
|
--with-mail=dynamic
|
|
|
|
--with-mail_ssl_module
|
|
|
|
--with-stream
|
|
|
|
--with-stream_realip_module
|
|
|
|
--with-stream_ssl_module
|
|
|
|
--with-stream_ssl_preread_module
|
|
|
|
--add-dynamic-module=mosc/headers-more-nginx-module
|
|
|
|
--add-dynamic-module=mosc/echo-nginx-module
|
|
|
|
--add-dynamic-module=mosc/ngx_brotli
|
|
|
|
--with-http_geoip_module
|
|
|
|
--with-stream_geoip_module
|
|
|
|
)
|
|
|
|
|
|
|
|
# NGINX Config Params configuration
|
2024-04-28 16:15:45 +00:00
|
|
|
case $SSL_LIB in
|
|
|
|
"quictls")
|
|
|
|
NGINX_CONFIG_PARAMS+=(
|
|
|
|
--with-openssl="/opt/quictls"
|
|
|
|
--with-cc-opt="-I/opt/quictls/.openssl/include -x c"
|
|
|
|
)
|
|
|
|
WITH_LD_OPT="-L/opt/quictls/.openssl/lib"
|
|
|
|
;;
|
|
|
|
"boringssl")
|
|
|
|
NGINX_CONFIG_PARAMS+=(
|
|
|
|
--with-cc-opt="-I../boringssl/include -x c"
|
|
|
|
)
|
|
|
|
WITH_LD_OPT="-L../boringssl/build/ssl -L../boringssl/build/crypto"
|
|
|
|
;;
|
|
|
|
"libressl")
|
|
|
|
NGINX_CONFIG_PARAMS+=(
|
|
|
|
--with-openssl="/opt/libressl"
|
|
|
|
--with-cc-opt="-x c"
|
|
|
|
)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2024-04-27 15:38:20 +00:00
|
|
|
if [ ! "${DISABLE_MODSECURITY}" == true ]; then
|
2024-04-28 07:06:06 +00:00
|
|
|
NGINX_CONFIG_PARAMS+=(
|
|
|
|
--add-dynamic-module=mosc/ModSecurity-nginx
|
2024-04-28 16:15:45 +00:00
|
|
|
)
|
2024-04-27 15:38:20 +00:00
|
|
|
fi
|
|
|
|
|
2024-04-28 16:15:45 +00:00
|
|
|
# SomeHow, Nginx is broken when compiling as dynamic module with BoringSSL.
|
|
|
|
# Compiling as module seems to fix this.
|
2024-04-27 15:38:20 +00:00
|
|
|
if [ ! "${DISABLE_LUA}" == true ]; then
|
|
|
|
NGINX_CONFIG_PARAMS+=(
|
2024-04-28 16:15:45 +00:00
|
|
|
--add-module=mosc/ngx_devel_kit
|
|
|
|
--add-module=mosc/lua-nginx-module
|
2024-04-27 15:38:20 +00:00
|
|
|
)
|
2024-04-28 16:15:45 +00:00
|
|
|
WITH_LD_OPT+=" -Wl,-rpath,$LUAJIT_LIB"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Build --with-ld-opt arguments here
|
|
|
|
if [[ -n ${WITH_LD_OPT} && ${WITH_LD_OPT} != "" ]]; then
|
2024-04-27 15:38:20 +00:00
|
|
|
NGINX_CONFIG_PARAMS+=(
|
2024-04-28 16:15:45 +00:00
|
|
|
--with-ld-opt="${WITH_LD_OPT}"
|
2024-04-27 15:38:20 +00:00
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
2024-03-23 15:15:09 +00:00
|
|
|
cd $HOMEDIRECTORY/nginx
|
2024-04-27 15:38:20 +00:00
|
|
|
./auto/configure "${NGINX_CONFIG_PARAMS[@]}"
|
2023-07-20 08:10:07 +00:00
|
|
|
|
2024-04-28 16:15:45 +00:00
|
|
|
# Prevent Error 127, When building.
|
|
|
|
if [ $SSL_LIB == "quictls" ]; then
|
2024-09-21 07:47:19 +00:00
|
|
|
sudo touch /opt/quictls/.openssl/include/openssl/ssl.h
|
2024-04-28 16:15:45 +00:00
|
|
|
elif [ $SSL_LIB == "libressl" ]; then
|
2024-09-21 07:47:19 +00:00
|
|
|
sudo touch /opt/libressl/.openssl/include/openssl/ssl.h
|
2024-04-28 16:15:45 +00:00
|
|
|
fi
|
2024-04-28 07:06:06 +00:00
|
|
|
|
2024-03-23 15:15:09 +00:00
|
|
|
make
|
2023-06-25 10:16:07 +00:00
|
|
|
|
2024-04-28 16:15:45 +00:00
|
|
|
#################################
|
|
|
|
## ##
|
|
|
|
## Install Nginx(optional) ##
|
|
|
|
## ##
|
|
|
|
#################################
|
|
|
|
|
2024-04-27 16:03:14 +00:00
|
|
|
if [[ $Nginx_Install == "yes" || $INSTALL == true ]]; then
|
2023-07-20 08:10:07 +00:00
|
|
|
mkdir -p /lib/nginx/ && mkdir -p /lib/nginx/modules
|
|
|
|
mkdir -p /etc/nginx && mkdir -p /etc/nginx/sites-enabled && mkdir -p /etc/nginx/modules-enabled
|
2023-10-30 19:32:21 +00:00
|
|
|
cp $HOMEDIRECTORY/nginx/objs/*.so /lib/nginx/modules
|
|
|
|
cp $HOMEDIRECTORY/nginx/objs/nginx /usr/sbin/nginx
|
2024-04-27 15:38:20 +00:00
|
|
|
|
|
|
|
cat >modules.conf <<EOL
|
|
|
|
load_module /lib/nginx/modules/ngx_http_echo_module.so;
|
|
|
|
load_module /lib/nginx/modules/ngx_http_headers_more_filter_module.so;
|
|
|
|
load_module /lib/nginx/modules/ngx_http_brotli_filter_module.so;
|
|
|
|
load_module /lib/nginx/modules/ngx_http_brotli_static_module.so;
|
|
|
|
EOL
|
|
|
|
|
|
|
|
if [ ! "${DISABLE_MODSECURITY}" == true ]; then
|
2024-04-28 07:06:06 +00:00
|
|
|
cat >>modules.conf <<EOL
|
|
|
|
load_module /lib/nginx/modules/ngx_http_modsecurity_module.so;
|
|
|
|
EOL
|
2024-04-27 15:38:20 +00:00
|
|
|
fi
|
|
|
|
|
2023-06-25 10:16:07 +00:00
|
|
|
cp modules.conf /etc/nginx/modules-enabled
|
|
|
|
else
|
2024-02-25 15:18:16 +00:00
|
|
|
echo "Nginx_Install variable isn't set/vaild. Your Nginx assets location is : '$HOMEDIRECTORY'/nginx/objs"
|
2024-09-04 23:00:06 +00:00
|
|
|
fi
|