mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 01:39:25 +08:00
@@ -64,6 +64,14 @@ http
|
|||||||
gzip_proxied expired no-cache no-store private auth;
|
gzip_proxied expired no-cache no-store private auth;
|
||||||
gzip_disable "MSIE [1-6]\.";
|
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 $binary_remote_addr zone=perip:10m;
|
||||||
limit_conn_zone $server_name zone=perserver: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 /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.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
|
# 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}'`
|
# 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}"
|
# OPTIONS="${OPTIONS} --with-openssl=${OPENSSL_LIB_DEPEND_DIR}"
|
||||||
else
|
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"
|
echo "openssl"
|
||||||
# if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
|
# 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
|
# 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}"
|
# OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
|
||||||
fi
|
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
|
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
|
||||||
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
|
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}'`
|
# 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}"
|
# OPTIONS="${OPTIONS} --with-openssl=${OPENSSL_LIB_DEPEND_DIR}"
|
||||||
else
|
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"
|
echo "openssl"
|
||||||
# if [ ! -f ${openrestyDir}/openssl-${opensslVersion}.tar.gz ];then
|
# 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
|
# 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}"
|
# OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
|
||||||
fi
|
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
|
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
|
||||||
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
|
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}'`
|
# 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}"
|
# OPTIONS="${OPTIONS} --with-openssl=${OPENSSL_LIB_DEPEND_DIR}"
|
||||||
else
|
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
|
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
|
wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
|
||||||
fi
|
fi
|
||||||
@@ -113,6 +122,13 @@ Install_openresty()
|
|||||||
OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
|
OPTIONS="${OPTIONS} --with-openssl=${openrestyDir}/openssl-${opensslVersion}"
|
||||||
fi
|
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
|
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
|
||||||
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
|
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}'`
|
# 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}"
|
# OPTIONS="${OPTIONS} --with-openssl=${OPENSSL_LIB_DEPEND_DIR}"
|
||||||
else
|
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
|
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
|
wget --no-check-certificate -O ${openrestyDir}/openssl-${opensslVersion}.tar.gz https://www.openssl.org/source/openssl-${opensslVersion}.tar.gz
|
||||||
fi
|
fi
|
||||||
@@ -129,6 +138,13 @@ Install_openresty()
|
|||||||
OPTIONS="${OPTIONS} --with-cc-opt=-I${openrestyDir}/libressl-${libresslVersion}/libressl/build/lib"
|
OPTIONS="${OPTIONS} --with-cc-opt=-I${openrestyDir}/libressl-${libresslVersion}/libressl/build/lib"
|
||||||
fi
|
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 \
|
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
|
||||||
--prefix=$serverPath/openresty \
|
--prefix=$serverPath/openresty \
|
||||||
|
|||||||
@@ -129,6 +129,13 @@ Install_openresty()
|
|||||||
OPTIONS="${OPTIONS} --with-cc-opt=-I${openrestyDir}/libressl-${libresslVersion}/libressl/build/lib"
|
OPTIONS="${OPTIONS} --with-cc-opt=-I${openrestyDir}/libressl-${libresslVersion}/libressl/build/lib"
|
||||||
fi
|
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 \
|
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
|
||||||
--prefix=$serverPath/openresty \
|
--prefix=$serverPath/openresty \
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ sysName=`uname`
|
|||||||
action=$1
|
action=$1
|
||||||
type=$2
|
type=$2
|
||||||
|
|
||||||
VERSION=1.29.2.1
|
VERSION=1.29.2.3
|
||||||
|
|
||||||
openrestyDir=${serverPath}/source/openresty
|
openrestyDir=${serverPath}/source/openresty
|
||||||
|
|
||||||
@@ -72,9 +72,9 @@ Install_openresty()
|
|||||||
|
|
||||||
OPTIONS=''
|
OPTIONS=''
|
||||||
|
|
||||||
opensslVersion="1.1.1p"
|
opensslVersion="3.4.4"
|
||||||
libresslVersion="3.9.1"
|
libresslVersion="3.9.1"
|
||||||
pcreVersion='8.38'
|
pcreVersion='8.45'
|
||||||
if [ "$sysName" == "Darwin" ];then
|
if [ "$sysName" == "Darwin" ];then
|
||||||
|
|
||||||
if [ ! -f ${openrestyDir}/pcre-${pcreVersion}.tar.gz ];then
|
if [ ! -f ${openrestyDir}/pcre-${pcreVersion}.tar.gz ];then
|
||||||
@@ -114,7 +114,7 @@ Install_openresty()
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$VERSION" =~ "1.25.3" ]] || [[ "$VERSION" =~ "1.27.1" ]];then
|
if [[ "$VERSION" =~ "1.29.2" ]];then
|
||||||
OPTIONS="${OPTIONS} --with-http_v3_module"
|
OPTIONS="${OPTIONS} --with-http_v3_module"
|
||||||
|
|
||||||
if [ ! -f ${openrestyDir}/libressl-${libresslVersion}.tar.gz ];then
|
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"
|
OPTIONS="${OPTIONS} --with-cc-opt=-I${openrestyDir}/libressl-${libresslVersion}/libressl/build/lib"
|
||||||
fi
|
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 \
|
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
|
||||||
--prefix=$serverPath/openresty \
|
--prefix=$serverPath/openresty \
|
||||||
@@ -167,6 +175,10 @@ Install_openresty()
|
|||||||
if [ -d $openrestyDir/openresty-${VERSION} ];then
|
if [ -d $openrestyDir/openresty-${VERSION} ];then
|
||||||
rm -rf $openrestyDir/openresty-${VERSION}
|
rm -rf $openrestyDir/openresty-${VERSION}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# if [ -d $openrestyDir/ngx_brotli ];then
|
||||||
|
# rm -rf $openrestyDir/ngx_brotli
|
||||||
|
# fi
|
||||||
echo 'Installation of Openresty completed'
|
echo 'Installation of Openresty completed'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+26
-2
@@ -399,12 +399,36 @@ def systemdCfgDir():
|
|||||||
return "/tmp"
|
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:
|
if not times:
|
||||||
times = int(time.time())
|
times = int(time.time())
|
||||||
|
|
||||||
|
# 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)
|
time_local = time.localtime(times)
|
||||||
return time.strftime(format, time_local)
|
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):
|
def strfToTime(sdate):
|
||||||
|
|||||||
Reference in New Issue
Block a user