码迷,mamicode.com
首页 > 其他好文 > 详细

Nginx配置GZIP

时间:2017-11-07 11:22:14      阅读:271      评论:0      收藏:0      [点我收藏+]

标签:height   order   bin   配置   vim   title   version   log   分享   

记录一次解决网站加载慢的问题


一. nginx配置

gzip on;
gzip_min_length  1k;
gzip_buffers     4 16k;
gzip_http_version 1.1;
gzip_comp_level 4;
gzip_types       text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;

技术分享

二、操作步骤

1. 编辑nginx配置

vim /usr/local/nginx/conf/nginx.conf

2. 重启nginx(重启时使用的是第一次启动时的配置文件,若无效,应该关闭nginx,并重新开启)

/usr/local/nginx/sbin/nginx -s reload       #修改配置后重新加载生效


nginx -t -c /path/to/nginx.conf  #测试nginx配置文件是否正确

ps -ef | grep nginx

kill -QUIT 主进程号     #从容停止Nginx
kill -TERM 主进程号     #快速停止Nginx
pkill -9 nginx          #强制停止Nginx

nginx -c /path/to/nginx.conf #重启nginx

Nginx配置GZIP

标签:height   order   bin   配置   vim   title   version   log   分享   

原文地址:http://www.cnblogs.com/Mr-Zhong/p/7797919.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!