Nginx 开启 Gzip 压缩
登录服务器
bash
ssh -v root@8.147.xxx.xxx
# 进入 Nginx 目录
cd /etc/nginx
# 修改 Nginx 配置
vim nginx.conf在 server 中添加 Gzip 压缩相关配置:
nginx
server {
listen 443 ssl;
server_name gp.noters.cn www.gp.noters.cn;
ssl_certificate_key /etc/nginx/ssl/gp.noters.cn/2_gp.noters.cn.key;
location / {
root /root/www/gp.noters.cn;
index index.html;
}
location ~ ^/(images|javascript|js|css|flash|media|static)/ {
expires 30d;
}
gzip on;
gzip_min_length 1k;
gzip_comp_level 6;
gzip_types application/atom+xml application/geo+json application/javascript application/x-javascript application/json application/ld+json application/manifest+json application/rdf+xml application/rss+xml application/xhtml+xml application/xml font/eot font/otf font/ttf image/svg+xml text/css text/javascript text/plain text/xml;
}