From d54cf2f6ced8b21d63135f0b0818c5b88ddcfa45 Mon Sep 17 00:00:00 2001 From: wangbo Date: Tue, 30 Jun 2026 22:00:27 +0800 Subject: [PATCH] chore: enable gzip for nginx api responses --- easyai-proxy.conf.sample | 15 +++++++++++++++ https.sh | 17 ++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/easyai-proxy.conf.sample b/easyai-proxy.conf.sample index 260f77a..72d16c0 100644 --- a/easyai-proxy.conf.sample +++ b/easyai-proxy.conf.sample @@ -32,6 +32,21 @@ server { listen [::]:80; server_name 51easyai.com; + # EasyAI response gzip: compress JSON/text API responses; SSE/WebSocket stay uncompressed by content type. + gzip on; + gzip_vary on; + gzip_min_length 1024; + gzip_comp_level 4; + gzip_proxied any; + gzip_types + application/json + application/javascript + application/xml + text/css + text/plain + text/xml + image/svg+xml; + # ssl 版本控制 ssl_protocols TLSv1.2 TLSv1.3; # 只启用 TLS 1.2 和 TLS 1.3 # 通用安全头部 diff --git a/https.sh b/https.sh index 9042673..76f0d0c 100755 --- a/https.sh +++ b/https.sh @@ -180,6 +180,21 @@ server { listen [::]:80; server_name $domain; + # EasyAI response gzip: compress JSON/text API responses; SSE/WebSocket stay uncompressed by content type. + gzip on; + gzip_vary on; + gzip_min_length 1024; + gzip_comp_level 4; + gzip_proxied any; + gzip_types + application/json + application/javascript + application/xml + text/css + text/plain + text/xml + image/svg+xml; + location /.well-known/acme-challenge/ { root /var/www/certbot; try_files \$uri =404; @@ -357,4 +372,4 @@ if [ -n "$DOMAINS" ]; then # 启动 Nginx 服务 echo "启动 Nginx 服务..." sudo nginx -fi \ No newline at end of file +fi