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

一. 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的更多相关文章

  1. Nginx配置gzip.md

    参考 入门系列之在Nginx配置Gzip gzip是一种流行的数据压缩程序.您可以使用gzip压缩Nginx实时文件.这些文件在检索时由支持它的浏览器解压缩,好处是web服务器和浏览器之间传输的数据量 ...

  2. 入门系列之在Nginx配置Gzip

    欢迎大家前往腾讯云+社区,获取更多腾讯海量技术实践干货哦~ 本文由小铁匠米兰的v 发表于云+社区专栏 简介 网站加载的速度取决于浏览器必须下载的所有文件的大小.减少要传输的文件的大小可以使网站不仅加载 ...

  3. Nginx 配置 Gzip 压缩

    打开配置文件 /etc/nginx/nginx.conf,取消掉以下的注释项: #gzip on; 取消后: gzip on; 在此配置后加上以下内容: gzip on; gzip_vary on; ...

  4. Web网站配置Gzip,压缩js css文件

    启用apache的gzip 找到httpd.conf,打开文件找到对mod_deflate的注释 #LoadModule deflate_module modules/mod_deflate.so 去 ...

  5. Nginx启用Gzip压缩js无效的原因

    Nginx启用gzip很简单,只需要设置一下配置文件即可完成,可以参考文章Nginx如何配置Gzip压缩功能.不过,在群里常有人提到,他们的网站Gzip压缩虽然成功了,但检测到JS仍然没有压缩成功,这 ...

  6. nginx之gzip压缩

    nginx的gizp压缩 为了使网站节省带宽和加快访问速度,在服务器方面的一个优化的就是使用nginx提供的gzip压缩. 一.使用压缩原理: 1.当用户使用浏览器访问网站时,就是在发送一个http请 ...

  7. nginx之gzip压缩提升网站速度

    目录: 为啥使用gzip压缩 nginx使用gzip gzip的常用配置参数 nginx配置gzip 注意 为啥使用gzip压缩 开启nginx的gzip压缩,网页中的js,css等静态资源的大小会大 ...

  8. nginx的gzip压缩

    随着nginx的发展,越来越多的网站使用nginx,因此nginx的优化变得越来越重要,今天我们来看看nginx的gzip压缩到底是怎么压缩的呢? gzip(GNU-ZIP)是一种压缩技术.经过gzi ...

  9. nginx配置跨域、gzip加速、代理详细讲解

    1.配置跨域 这个很简单,直接打开配置nginx.conf ,在http下配置下面三行代码:当然如果你是想某一个虚拟主机下跨域,那就在哪个server下面添加 add_header Access-Co ...

随机推荐

  1. 数据持久化-存取方式总结&应用沙盒&文件管理NSFileManager

    iOS应用数据存储的常用方式:  1.XML属性列表   (plist归档)  2.NSUserDefaults (偏好设置)  3.NSKeyedArchiver  归档(加密形式)  4.SQLi ...

  2. PatentTips - Device virtualization and assignment of interconnect devices

    BACKGROUND Standard computer interconnects, particularly for personal computers or workstations, may ...

  3. Template template parameter(模板參数) example

    /********************************************************************************* Copyright (C), 19 ...

  4. findFocus-获得拥有焦点的控件

    所有的view控件有一个findFocus方法,这个方法如下 /** * Find the view in the hierarchy rooted at this view that current ...

  5. button-xml 中android:clickable="false" 属性

    今天在做项目的时候,遇到了一个问题,就是需要把一个常按监听事件,加到一个linearlayout中,但是,这个linearlayout中有其他的button.textview等控件,这样就导致当我们常 ...

  6. .Net强类型视图

    1.控制器 Controllers/StoreController.cs using System; using System.Collections.Generic; using System.Li ...

  7. Android 学习笔记进阶十二之裁截图片

    package xiaosi.cut; import java.io.File; import android.app.Activity; import android.content.Intent; ...

  8. Springboot优化

    https://www.cnblogs.com/chen110xi/p/6198481.html

  9. POJ——T 2796 Feel Good

    http://poj.org/problem?id=2796 Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 15375   ...

  10. apache activemq Failed to bind to server socket 61616

    windows环境上: 首先 nestat -ano | findstr "61616" 查看是否有进程,有的话kill掉, 若没有发现,查看windows Internet Co ...