httpslinux gzip 压缩压缩有效果吗

nginx(14)
默认情况下ssl模块并未被安装,如果要使用该模块则需要在编译nginx时指定–with-http_ssl_module参数.
做一个网站域名为
要求通过进行访问.
10.10.100.8
1.首先确保机器上安装了openssl和openssl-devel
install openssl
install openssl-devel
2.创建服务器私钥,命令会让你输入一个口令:
genrsa -des3 -out&server.key
1024&br&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
#因为以后要给nginx使用。每次reload
nginx配置时候都要你验证这个PAM密码的.由于生成时候必须输入密码,你可以输入后 再删掉。
3.创建签名请求的证书(CSR):
req -new&-key
server.key -out&server.csr&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
4.在加载SSL支持的Nginx并使用上述私钥时除去必须的口令:
server.key server.key.org
rsa -in&server.key.org
-out&server.key&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
5.配置nginx
最后标记证书使用上述私钥和CSR:
x509 -req -days 365 -in&server.csr
-signkey server.key -out&server.crt
6.修改Nginx配置文件,让其包含新标记的证书和私钥:
/usr/local/nginx/conf/nginx.conf
&&&&&&&&include
7.修改Nginx配置文件,让其包含新标记的证书和私钥:
/usr/local/nginx/server/
&&&&&&&&listen&&&&&&
443;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&server_name&
&&&&&&&&ssl&&&&&&&&&&&&&&&&&&on;&&&&&&&
          
&&&&&&&&ssl_certificate&&&&&
/etc/pki/tls/certs/server.&&&&&&
&&&&&&&&ssl_certificate_key&
/etc/pki/tls/certs/server.&&&&&&
&&&&&&&&ssl_session_timeout&
&&&&&&&&ssl_protocols&
SSLv2 SSLv3 TLSv1;&&&&&&     &
&&&&&&&&ssl_ciphers&
HIGH:!aNULL:!MD5;&&&&&&&&&&&&&&
&&&&&&&&ssl_prefer_server_ciphers&&&on;&&&&&&&&&&&&&
&&&&&&&&location
&&&&&&&&&&&&root&&
&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&index&
index.html index.
8.启动nginx服务器.
#/usr/local/nginx/sbin/nginx
-s reload //如果环境允许的话直接杀掉进程在启动nginx
如果出现“[emerg] 10464#0: unknown directive &ssl& in /usr/local/nginx-0.6.32/conf/nginx.conf:74”则说明没有将ssl模块编译进nginx,在configure的时候加上“--with-http_ssl_module”即可
如:[root@localhost
nginx-1.4.4]# ./configure --prefix=/usr/local/nginx --user=www --group=www
--with-http_stub_status_module --with-http_ssl_module
9.测试网站是否能够通过https访问
另外还可以加入如下代码实现80端口重定向到443
server_name
^(.*) https://$server_name$1
^(.*)$& https:
过以下配置,可以设置一个虚拟主机同时支持HTTP和HTTPS
443&default&
参考文档:
SSL英文名为Secure Socket Layer,安全套接字层。SSL是一种数字证书,它使用ssl协议在浏览器和web server之间建立一条安全通道,数据信息在client与server之间的安全传输
在这之前,记得nginx编译安装时加参数–with-http_ssl_module,使得nginx支持ssl模块。
一、颁发证书
下面自行颁发不受浏览器信任的证书&
cd /usr/local/nginx/conf/key
1、创建服务器私钥,并输入口令&
openssl genrsa -des3 -out server.key 1024
2、创建签名请求的csr证书&
openssl req -new -key server.key -out server.csr
3、加载ssl支持的Nginx并使用私钥是除去必须的口令&
cp server.key server.key.org&
openssl rsa -in server.key.org -out server.key
二、配置Nginx
标记证书使用上述私钥和csr&
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
修改nginx配置档,使用ssl
&code class=&hljs applescript has-numbering& style=&display: padding: 0 color: box-sizing: border- font-family: &Source Code Pro&,font-size: white-space: border-radius: 0 word-wrap: background:&&server {
listen &span class=&hljs-number& style=&color: rgb(0, 102, 102); box-sizing: border-&&443&/span&;
server_name &span class=&hljs-number& style=&color: rgb(0, 102, 102); box-sizing: border-&&192.168&/span&&span class=&hljs-number& style=&color: rgb(0, 102, 102); box-sizing: border-&&.0&/span&&span class=&hljs-number& style=&color: rgb(0, 102, 102); box-sizing: border-&&.216&/span&;
autoindex &span class=&hljs-function_start& style=&box-sizing: border-&&&span class=&hljs-keyword& style=&color: rgb(0, 0, 136); box-sizing: border-&&on&/span&&/span&;
root /usr/&span class=&hljs-keyword& style=&color: rgb(0, 0, 136); box-sizing: border-&&local&/span&/
ssl &span class=&hljs-function_start& style=&box-sizing: border-&&&span class=&hljs-keyword& style=&color: rgb(0, 0, 136); box-sizing: border-&&on&/span&&/span&;
ssl_certificate /usr/&span class=&hljs-keyword& style=&color: rgb(0, 0, 136); box-sizing: border-&&local&/span&/nginx/conf/key/server.
ssl_certificate_key
/usr/&span class=&hljs-keyword& style=&color: rgb(0, 0, 136); box-sizing: border-&&local&/span&/nginx/conf/key/server.
}&/code&&ul class=&pre-numbering& style=&box-sizing: border- position: width: 50 top: 0 left: 0 margin: 0 padding: 6px 0px 40 border-right-width: 1 border-right-style: border-right-color: rgb(221, 221, 221); list-style: text-align: background-color: rgb(238, 238, 238);&&&li style=&box-sizing: border- padding: 0px 5&&1&/li&&li style=&box-sizing: border- padding: 0px 5&&2&/li&&li style=&box-sizing: border- padding: 0px 5&&3&/li&&li style=&box-sizing: border- padding: 0px 5&&4&/li&&li style=&box-sizing: border- padding: 0px 5&&5&/li&&li style=&box-sizing: border- padding: 0px 5&&6&/li&&li style=&box-sizing: border- padding: 0px 5&&7&/li&&li style=&box-sizing: border- padding: 0px 5&&8&/li&&li style=&box-sizing: border- padding: 0px 5&&9&/li&&li style=&box-sizing: border- padding: 0px 5&&10&/li&&li style=&box-sizing: border- padding: 0px 5&&11&/li&&/ul&
配置完成后启动nginx,https访问
/usr/local/nginx/sbin/nginx -t&
/usr/local/nginx/sbin/nginx
可以看到访问成功,只是ssl证书不是受信的而已
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Nginx开启Gzip压缩大幅提高页面加载速度及相关测试
文章作者:姜南(Slyar)&文章来源:Slyar Home ()
转载请注明,谢谢合作。
刚刚给博客加了一个500px相册插件,lightbox引入了很多js文件和css文件,页面一下子看起来非常臃肿,所以还是把Gzip打开了。
环境:Debian 6
1、Vim打开Nginx配置文件
vim&/usr/local/nginx/conf/nginx.conf
2、找到如下一段,进行修改
gzip_min_length 1k;
gzip_buffers 4 16k;
#gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/
gzip_disable &MSIE [1-6]\.&;
3、解释一下
第1行:开启Gzip
第2行:不压缩临界值,大于1K的才压缩,一般不用改
第3行:buffer,就是,嗯,算了不解释了,不用改
第4行:用了反向代理的话,末端通信是HTTP/1.0,有需求的应该也不用看我这科普文了;有这句的话注释了就行了,默认是HTTP/1.1
第5行:压缩级别,1-10,数字越大压缩的越好,时间也越长,看心情随便改吧
第6行:进行压缩的文件类型,缺啥补啥就行了,JavaScript有两种写法,最好都写上吧,总有人抱怨js文件没有压缩,其实多写一种格式就行了
第7行:跟Squid等缓存服务有关,on的话会在Header里增加&Vary: Accept-Encoding&,我不需要这玩意,自己对照情况看着办吧
第8行:IE6对Gzip不怎么友好,不给它Gzip了
4、:wq保存退出,重新加载Nginx
/usr/local/nginx/sbin/nginx -s reload
5、用curl测试Gzip是否成功开启
curl -I -H &Accept-Encoding: gzip, deflate& &///blog/&
HTTP/1.1 200 OK
Server: nginx/1.0.15
Date: Sun, 26 Aug :09 GMT
Content-Type: text/ charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.2.17p1
X-Pingback: ///blog/xmlrpc.php
Content-Encoding: gzip
页面成功压缩
curl -I -H &Accept-Encoding: gzip, deflate& &///blog/wp-content/plugins/photonic/include/css/photonic.css&
HTTP/1.1 200 OK
Server: nginx/1.0.15
Date: Sun, 26 Aug :25 GMT
Content-Type: text/css
Last-Modified: Sun, 26 Aug :07 GMT
Connection: keep-alive
Expires: Mon, 27 Aug :25 GMT
Cache-Control: max-age=43200
Content-Encoding: gzip
css文件成功压缩
curl -I -H &Accept-Encoding: gzip, deflate& &///blog/wp-includes/js/jquery/jquery.js&
HTTP/1.1 200 OK
Server: nginx/1.0.15
Date: Sun, 26 Aug :38 GMT
Content-Type: application/x-javascript
Last-Modified: Thu, 12 Jul :45 GMT
Connection: keep-alive
Expires: Mon, 27 Aug :38 GMT
Cache-Control: max-age=43200
Content-Encoding: gzip
js文件成功压缩
curl -I -H &Accept-Encoding: gzip, deflate& &///blog/wp-content/uploads/2-08-23_203542.png&
HTTP/1.1 200 OK
Server: nginx/1.0.15
Date: Sun, 26 Aug :45 GMT
Content-Type: image/png
Last-Modified: Thu, 23 Aug :53 GMT
Connection: keep-alive
Expires: Tue, 25 Sep :45 GMT
Cache-Control: max-age=2592000
Content-Encoding: gzip
图片成功压缩
curl -I -H &Accept-Encoding: gzip, deflate& &///blog/wp-content/plugins/wp-multicollinks/wp-multicollinks.css&
HTTP/1.1 200 OK
Server: nginx/1.0.15
Date: Sun, 26 Aug :27 GMT
Content-Type: text/css
Content-Length: 180
Last-Modified: Sat, 02 May :15 GMT
Connection: keep-alive
Expires: Mon, 27 Aug :27 GMT
Cache-Control: max-age=43200
Accept-Ranges: bytes
最后来个不到1K的文件,由于我的阈值是1K,所以没压缩
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:13774次
排名:千里之外
原创:30篇
转载:135篇
(16)(35)(21)(2)(1)(2)(23)(17)(3)(15)(1)(5)(7)(11)(8)(2)安全检查中...
请打开浏览器的javascript,然后刷新浏览器
mycodes.net 浏览器安全检查中...
还剩 5 秒&查看: 681|回复: 6
网页_GZIP解压
命令的解答
阅读权限30
在线时间 小时
签到天数:1 天结帖率: (6/8)
在进行POST 操作时候, 就是得加上 网页_GZIP解压&&这个命令,还得附带个gzip.dll 的文件 才能post 成功 ,这是为什么呢? 这个命令有什么作用, gzip.dll这个文件又起到什么作用呢?
网页_GZIP解压一般用于对post之后的返回文本进行一些处理把,因为有些网站对数据的进行压缩的,常见的就是gzip压缩的方式
至于为什么一定要带上dll
就像模块里面有很多封装好的api你根本不知道,如果没有这些api,你就没法通过一个命令直接使用
再通俗一些,网页_GZIP解压是一辆汽车,如果没有dll这个作为汽油让它整个汽车拥有动力,车子开不了
我的建议,你既然都已经使用了这个网页_GZIP解压这个命令了,就没有必要去了解深 ...
求助知识:请将问题描述清楚,最好把你有问题的源码打包上传上来,这样更方便大家帮助你。友情提醒:本版被采纳的主题可在
帖子申请荣誉值,获得 3点 荣誉值,荣誉值可兑换终身vip用户组哦。
阅读权限180
在线时间 小时
签到天数: 22 天结帖率: (3/3)
网页_GZIP解压一般用于对post之后的返回文本进行一些处理把,因为有些网站对数据的进行压缩的,常见的就是gzip压缩的方式
至于为什么一定要带上dll
就像模块里面有很多封装好的api你根本不知道,如果没有这些api,你就没法通过一个命令直接使用
再通俗一些,网页_GZIP解压是一辆汽车,如果没有dll这个作为汽油让它整个汽车拥有动力,车子开不了
我的建议,你既然都已经使用了这个网页_GZIP解压这个命令了,就没有必要去了解深层次的东西了,现在就告诉你,要是使用这个命令,需带上dll,你带上便是。
热心帮助他人,荣誉+3,希望继续努力(*^__^*) 嘻嘻!
阅读权限90
在线时间 小时
签到天数: 8 天结帖率: (2/2)
直接POST不用网页_GZIP解压& &直接提交数据不就行了
阅读权限90
在线时间 小时
楼上正解 而你用winnet模板就不用解压了
阅读权限90
在线时间 小时
签到天数: 13 天结帖率: (4/7)
协yi头问题,一般可以不用GZIP解压,你POST协yi头没有处理
阅读权限30
在线时间 小时
签到天数: 3 天
看看自己协yi头就明白了
阅读权限30
在线时间 小时
签到天数: 1 天结帖率: (6/8)
网页_GZIP解压一般用于对post之后的返回文本进行一些处理把,因为有些网站对数据的进行压缩的,常见的就是 ...
明白了,后来仔细研究了下协yi头 是Accept-Encoding: gzip, deflate 多了这行的东西 ,删掉后,就不用那个命令了。
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
揭阳精易科技有限公司申明:我公司所有的培训课程版权归精易所有,任何人以任何方式翻录、盗版、破解本站培训课程,我们必将通过法律途径解决!
公司简介:揭阳市揭东区精易科技有限公司致力于易语言教学培训/易语言学习交流社区的建设与软件开发,多年来为中小企业编写过许许多多各式软件,并把多年积累的开发经验逐步录制成视频课程供学员学习,让学员全面系统化学习易语言编程,少走弯路,减少对相关技术的研究与摸索时间,从而加快了学习进度!
Powered by

我要回帖

更多关于 https gzip 无效 的文章

 

随机推荐