Merge pull request #874 from midoks/dev

openresty配置优化
This commit is contained in:
Mr Chen
2026-04-07 15:30:38 +08:00
committed by GitHub
3 changed files with 16 additions and 7 deletions
+5 -5
View File
@@ -55,12 +55,12 @@ http
fastcgi_temp_file_write_size 256k; fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on; fastcgi_intercept_errors on;
#zstd on; zstd off;
#zstd_comp_level 6; zstd_comp_level 6;
#zstd_min_length 256; zstd_min_length 256;
#zstd_types text/plain text/css text/xml text/javascript text/cache-manifest text/x-component text/vtt application/javascript application/json application/ld+json application/xml application/xhtml+xml application/rss+xml application/atom+xml application/manifest+json application/x-web-app-manifest+json application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/wasm font/opentype image/svg+xml image/bmp; zstd_types text/plain text/css text/xml text/javascript text/cache-manifest text/x-component text/vtt application/javascript application/json application/ld+json application/xml application/xhtml+xml application/rss+xml application/atom+xml application/manifest+json application/x-web-app-manifest+json application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/wasm font/opentype image/svg+xml image/bmp;
brotli on; brotli off;
brotli_min_length 256; brotli_min_length 256;
brotli_buffers 32 8k; brotli_buffers 32 8k;
brotli_comp_level 6; brotli_comp_level 6;
+9 -2
View File
@@ -474,7 +474,9 @@ def getCfg():
{"name": "worker_processes", "ps": "处理进程,auto表示自动,数字表示进程数", 'type': 2}, {"name": "worker_processes", "ps": "处理进程,auto表示自动,数字表示进程数", 'type': 2},
{"name": "worker_connections", "ps": "最大并发链接数", 'type': 2}, {"name": "worker_connections", "ps": "最大并发链接数", 'type': 2},
{"name": "keepalive_timeout", "ps": "连接超时时间", 'type': 2}, {"name": "keepalive_timeout", "ps": "连接超时时间", 'type': 2},
{"name": "gzip", "ps": "是否开启压缩传输", 'type': 1}, {"name": "zstd", "ps": "是否开启zstd压缩传输", 'type': 1},
{"name": "brotli", "ps": "是否开启brotli压缩传输", 'type': 1},
{"name": "gzip", "ps": "是否开启gzip压缩传输", 'type': 1},
{"name": "gzip_min_length", "ps": "最小压缩文件", 'type': 2}, {"name": "gzip_min_length", "ps": "最小压缩文件", 'type': 2},
{"name": "gzip_comp_level", "ps": "压缩率", 'type': 2}, {"name": "gzip_comp_level", "ps": "压缩率", 'type': 2},
{"name": "client_max_body_size", "ps": "最大上传文件", 'type': 2}, {"name": "client_max_body_size", "ps": "最大上传文件", 'type': 2},
@@ -534,7 +536,7 @@ def setCfg():
args = getArgs() args = getArgs()
data = checkArgs(args, [ data = checkArgs(args, [
'worker_processes', 'worker_connections', 'keepalive_timeout', 'worker_processes', 'worker_connections', 'keepalive_timeout','zstd','brotli',
'gzip', 'gzip_min_length', 'gzip_comp_level', 'client_max_body_size', 'gzip', 'gzip_min_length', 'gzip_comp_level', 'client_max_body_size',
'server_names_hash_bucket_size', 'client_header_buffer_size' 'server_names_hash_bucket_size', 'client_header_buffer_size'
]) ])
@@ -550,6 +552,8 @@ def setCfg():
{"name": "worker_processes", "ps": "处理进程,auto表示自动,数字表示进程数", 'type': 2}, {"name": "worker_processes", "ps": "处理进程,auto表示自动,数字表示进程数", 'type': 2},
{"name": "worker_connections", "ps": "最大并发链接数", 'type': 2}, {"name": "worker_connections", "ps": "最大并发链接数", 'type': 2},
{"name": "keepalive_timeout", "ps": "连接超时时间", 'type': 2}, {"name": "keepalive_timeout", "ps": "连接超时时间", 'type': 2},
{"name": "zstd", "ps": "是否开启zstd压缩传输", 'type': 1},
{"name": "brotli", "ps": "是否开启brotli压缩传输", 'type': 1},
{"name": "gzip", "ps": "是否开启压缩传输", 'type': 1}, {"name": "gzip", "ps": "是否开启压缩传输", 'type': 1},
{"name": "gzip_min_length", "ps": "最小压缩文件", 'type': 2}, {"name": "gzip_min_length", "ps": "最小压缩文件", 'type': 2},
{"name": "gzip_comp_level", "ps": "压缩率", 'type': 2}, {"name": "gzip_comp_level", "ps": "压缩率", 'type': 2},
@@ -566,6 +570,9 @@ def setCfg():
if k == "worker_processes" or k == "gzip": if k == "worker_processes" or k == "gzip":
if not re.search(r"auto|on|off|\d+", v): if not re.search(r"auto|on|off|\d+", v):
return mw.returnJson(False, '参数值错误') return mw.returnJson(False, '参数值错误')
elif k == "zstd" or k == "brotli":
if not re.search(r"auto|on|off|\d+", v):
return mw.returnJson(False, '参数值错误')
else: else:
if not re.search(r"\d+", v): if not re.search(r"\d+", v):
return mw.returnJson(False, '参数值错误,请输入数字整数') return mw.returnJson(False, '参数值错误,请输入数字整数')
+2
View File
@@ -185,6 +185,8 @@ function submitConf() {
worker_processes: $("input[name='worker_processes']").val(), worker_processes: $("input[name='worker_processes']").val(),
worker_connections: $("input[name='worker_connections']").val(), worker_connections: $("input[name='worker_connections']").val(),
keepalive_timeout: $("input[name='keepalive_timeout']").val(), keepalive_timeout: $("input[name='keepalive_timeout']").val(),
zstd: $("select[name='zstd']").val() || 'on',
brotli: $("select[name='brotli']").val() || 'on',
gzip: $("select[name='gzip']").val() || 'on', gzip: $("select[name='gzip']").val() || 'on',
gzip_min_length: $("input[name='gzip_min_length']").val(), gzip_min_length: $("input[name='gzip_min_length']").val(),
gzip_comp_level: $("input[name='gzip_comp_level']").val(), gzip_comp_level: $("input[name='gzip_comp_level']").val(),