chore: enable gzip for nginx api responses
This commit is contained in:
@@ -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
|
||||
# 通用安全头部
|
||||
|
||||
@@ -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
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user