Merge pull request #864 from midoks/dev

openresty 加入br功能
master
Mr Chen 3 days ago committed by GitHub
commit 9cee124afd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      plugins/openresty/conf/nginx.conf
  2. 3
      plugins/openresty/install.sh
  3. 17
      plugins/openresty/versions/1.17.8/install.sh
  4. 17
      plugins/openresty/versions/1.19.3/install.sh
  5. 16
      plugins/openresty/versions/1.21.4/install.sh
  6. 16
      plugins/openresty/versions/1.25.3/install.sh
  7. 7
      plugins/openresty/versions/1.27.1/install.sh
  8. 20
      plugins/openresty/versions/1.29.2/install.sh
  9. 30
      web/core/mw.py

@ -64,6 +64,14 @@ http
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
brotli on;
brotli_min_length 256;
brotli_buffers 32 8k;
brotli_comp_level 6;
brotli_window 16m;
brotli_static on;
brotli_types text/plain text/css text/xml text/javascript text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml application/atom+xml application/vnd.ms-fontobject application/x-font-ttf application/x-font-opentype application/x-font-truetype font/tpl font/opentype font/otf font/ttf image/svg+xml image/x-icon image/vnd.microsoft.icon application/wasm application/manifest+json;
limit_conn_zone $binary_remote_addr zone=perip:10m;
limit_conn_zone $server_name zone=perserver:10m;

@ -4,6 +4,9 @@ export PATH
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/openresty && bash install.sh install 1.21.4
# cd /www/server/mdserver-web/plugins/openresty && bash install.sh install 1.21.4
# cd /www/server/mdserver-web/plugins/openresty && bash install.sh install 1.29.2
# curl -I -H "Accept-Encoding: br" http://localhost
# cd /www/server/mdserver-web && python3 plugins/openresty/index.py run_info

@ -102,6 +102,15 @@ Install_openresty()
# OPENSSL_LIB_DEPEND_DIR=`brew info openssl@1.1 | grep ${BREW_DIR}/Cellar/openssl@1.1 | cut -d \ -f 1 | awk 'END {print}'`
# OPTIONS="${OPTIONS} --with-openssl=${OPENSSL_LIB_DEPEND_DIR}"
else
if [ ! -f ${openrestyDir}/pcre-${pcreVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/pcre-${pcreVersion}.tar.gz https://netix.dl.sourceforge.net/project/pcre/pcre/${pcreVersion}/pcre-${pcreVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/pcre-${pcreVersion} ];then
cd ${openrestyDir} && tar -zxvf pcre-${pcreVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-pcre=${openrestyDir}/pcre-${pcreVersion}"
echo "openssl"
# if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
# wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
@ -113,6 +122,14 @@ Install_openresty()
# OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
fi
# br
if [ ! -d ${openrestyDir}/openresty-${VERSION}/ngx_brotli ];then
cd ${openrestyDir}/openresty-${VERSION} && git clone https://github.com/wxx9248/ngx_brotli.git
cd ${openrestyDir}/openresty-${VERSION}/ngx_brotli && git submodule update --init
OPTIONS="${OPTIONS} --add-module=./ngx_brotli"
fi
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
cd ${openrestyDir}/openresty-${VERSION} && ./configure \

@ -103,6 +103,15 @@ Install_openresty()
# OPENSSL_LIB_DEPEND_DIR=`brew info openssl@1.1 | grep ${BREW_DIR}/Cellar/openssl@1.1 | cut -d \ -f 1 | awk 'END {print}'`
# OPTIONS="${OPTIONS} --with-openssl=${OPENSSL_LIB_DEPEND_DIR}"
else
if [ ! -f ${openrestyDir}/pcre-${pcreVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/pcre-${pcreVersion}.tar.gz https://netix.dl.sourceforge.net/project/pcre/pcre/${pcreVersion}/pcre-${pcreVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/pcre-${pcreVersion} ];then
cd ${openrestyDir} && tar -zxvf pcre-${pcreVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-pcre=${openrestyDir}/pcre-${pcreVersion}"
echo "openssl"
# if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
# wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
@ -114,6 +123,14 @@ Install_openresty()
# OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
fi
# br
if [ ! -d ${openrestyDir}/openresty-${VERSION}/ngx_brotli ];then
cd ${openrestyDir}/openresty-${VERSION} && git clone https://github.com/wxx9248/ngx_brotli.git
cd ${openrestyDir}/openresty-${VERSION}/ngx_brotli && git submodule update --init
OPTIONS="${OPTIONS} --add-module=./ngx_brotli"
fi
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
cd ${openrestyDir}/openresty-${VERSION} && ./configure \

@ -103,6 +103,15 @@ Install_openresty()
# OPENSSL_LIB_DEPEND_DIR=`brew info openssl@1.1 | grep ${BREW_DIR}/Cellar/openssl@1.1 | cut -d \ -f 1 | awk 'END {print}'`
# OPTIONS="${OPTIONS} --with-openssl=${OPENSSL_LIB_DEPEND_DIR}"
else
if [ ! -f ${openrestyDir}/pcre-${pcreVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/pcre-${pcreVersion}.tar.gz https://netix.dl.sourceforge.net/project/pcre/pcre/${pcreVersion}/pcre-${pcreVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/pcre-${pcreVersion} ];then
cd ${openrestyDir} && tar -zxvf pcre-${pcreVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-pcre=${openrestyDir}/pcre-${pcreVersion}"
if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
fi
@ -113,6 +122,13 @@ Install_openresty()
OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
fi
# br
if [ ! -d ${openrestyDir}/openresty-${VERSION}/ngx_brotli ];then
cd ${openrestyDir}/openresty-${VERSION} && git clone https://github.com/wxx9248/ngx_brotli.git
cd ${openrestyDir}/openresty-${VERSION}/ngx_brotli && git submodule update --init
OPTIONS="${OPTIONS} --add-module=./ngx_brotli"
fi
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
cd ${openrestyDir}/openresty-${VERSION} && ./configure \

@ -103,6 +103,15 @@ Install_openresty()
# OPENSSL_LIB_DEPEND_DIR=`brew info openssl@1.1 | grep ${BREW_DIR}/Cellar/openssl@1.1 | cut -d \ -f 1 | awk 'END {print}'`
# OPTIONS="${OPTIONS} --with-openssl=${OPENSSL_LIB_DEPEND_DIR}"
else
if [ ! -f ${openrestyDir}/pcre-${pcreVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/pcre-${pcreVersion}.tar.gz https://netix.dl.sourceforge.net/project/pcre/pcre/${pcreVersion}/pcre-${pcreVersion}.tar.gz
fi
if [ ! -d ${openrestyDir}/pcre-${pcreVersion} ];then
cd ${openrestyDir} && tar -zxvf pcre-${pcreVersion}.tar.gz
fi
OPTIONS="${OPTIONS} --with-pcre=${openrestyDir}/pcre-${pcreVersion}"
if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
fi
@ -129,6 +138,13 @@ Install_openresty()
OPTIONS="${OPTIONS} --with-cc-opt=-I${openrestyDir}/libressl-${libresslVersion}/libressl/build/lib"
fi
# br
if [ ! -d ${openrestyDir}/openresty-${VERSION}/ngx_brotli ];then
cd ${openrestyDir}/openresty-${VERSION} && git clone https://github.com/wxx9248/ngx_brotli.git
cd ${openrestyDir}/openresty-${VERSION}/ngx_brotli && git submodule update --init
OPTIONS="${OPTIONS} --add-module=./ngx_brotli"
fi
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
--prefix=$serverPath/openresty \

@ -129,6 +129,13 @@ Install_openresty()
OPTIONS="${OPTIONS} --with-cc-opt=-I${openrestyDir}/libressl-${libresslVersion}/libressl/build/lib"
fi
# br
if [ ! -d ${openrestyDir}/openresty-${VERSION}/ngx_brotli ];then
cd ${openrestyDir}/openresty-${VERSION} && git clone https://github.com/wxx9248/ngx_brotli.git
cd ${openrestyDir}/openresty-${VERSION}/ngx_brotli && git submodule update --init
OPTIONS="${OPTIONS} --add-module=./ngx_brotli"
fi
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
--prefix=$serverPath/openresty \

@ -14,7 +14,7 @@ sysName=`uname`
action=$1
type=$2
VERSION=1.29.2.1
VERSION=1.29.2.3
openrestyDir=${serverPath}/source/openresty
@ -72,9 +72,9 @@ Install_openresty()
OPTIONS=''
opensslVersion="1.1.1p"
opensslVersion="3.4.4"
libresslVersion="3.9.1"
pcreVersion='8.38'
pcreVersion='8.45'
if [ "$sysName" == "Darwin" ];then
if [ ! -f ${openrestyDir}/pcre-${pcreVersion}.tar.gz ];then
@ -114,7 +114,7 @@ Install_openresty()
fi
if [[ "$VERSION" =~ "1.25.3" ]] || [[ "$VERSION" =~ "1.27.1" ]];then
if [[ "$VERSION" =~ "1.29.2" ]];then
OPTIONS="${OPTIONS} --with-http_v3_module"
if [ ! -f ${openrestyDir}/libressl-${libresslVersion}.tar.gz ];then
@ -129,6 +129,14 @@ Install_openresty()
OPTIONS="${OPTIONS} --with-cc-opt=-I${openrestyDir}/libressl-${libresslVersion}/libressl/build/lib"
fi
# br
if [ ! -d ${openrestyDir}/openresty-${VERSION}/ngx_brotli ];then
cd ${openrestyDir}/openresty-${VERSION} && git clone https://github.com/wxx9248/ngx_brotli.git
cd ${openrestyDir}/openresty-${VERSION}/ngx_brotli && git submodule update --init
OPTIONS="${OPTIONS} --add-module=./ngx_brotli"
fi
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
--prefix=$serverPath/openresty \
@ -167,6 +175,10 @@ Install_openresty()
if [ -d $openrestyDir/openresty-${VERSION} ];then
rm -rf $openrestyDir/openresty-${VERSION}
fi
# if [ -d $openrestyDir/ngx_brotli ];then
# rm -rf $openrestyDir/ngx_brotli
# fi
echo 'Installation of Openresty completed'
}

@ -399,12 +399,36 @@ def systemdCfgDir():
return "/tmp"
def formatDate(format="%Y-%m-%d %H:%M:%S", times=None):
def formatDate(fmat="%Y-%m-%d %H:%M:%S", times=None, time_zone=None):
# 格式化指定时间戳
if not times:
times = int(time.time())
time_local = time.localtime(times)
return time.strftime(format, time_local)
# if time_zone is None:
# try:
# import tzlocal
# time_zone = str(tzlocal.get_localzone())
# except:
# try:
# time_zone = time.tzname[0]
# except:
# time_zone = None
if time_zone:
old_tz = os.environ.get('TZ')
os.environ['TZ'] = time_zone
time.tzset()
time_local = time.localtime(times)
result = time.strftime(fmat, time_local)
if old_tz:
os.environ['TZ'] = old_tz
else:
del os.environ['TZ']
time.tzset()
return result
else:
time_local = time.localtime(times)
return time.strftime(fmat, time_local)
def strfToTime(sdate):

Loading…
Cancel
Save