zipzty 发表于 2015-12-19 12:07:15

lnmpa中gzip 压缩问题

apahce的 rewrite是这样的:Options +FollowSymLinks
RewriteEngine on

RewriteCond %{HTTP:Accept-encoding} gzip
RewriteRule (.*)Release(.*)\.js $1Compressed$2\.jsgz
RewriteRule (.*)Release(.*)\.data $1Compressed$2\.datagz
RewriteRule (.*)Release(.*)\.mem $1Compressed$2\.memgz
RewriteRule (.*)Release(.*)\.unity3d $1Compressed$2\.unity3dgz
AddEncoding gzip .jsgz
AddEncoding gzip .datagz
AddEncoding gzip .memgz
AddEncoding gzip .unity3dgz


但在nginx 下是不起作用的 如何让apahce来执行这个rewrite 或者请大家帮把这个rewrite的转换为 nginx的

licess 发表于 2015-12-19 16:39:25

rewrite /(.*)Release(.*).js /$1Compressed$2.jsgz last;
rewrite /(.*)Release(.*).data /$1Compressed$2.datagz last;
rewrite /(.*)Release(.*).mem /$1Compressed$2.memgz last;
rewrite /(.*)Release(.*).unity3d /$1Compressed$2.unity3dgz last;

你可以curl -IL 你的文件看看的Content-Type是什么类型的加到nginx.conf 的gzip_type里试试看

你用的什么程序,官网应该都有提高吧

zipzty 发表于 2015-12-19 17:30:10

gzip_types   text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss application/octet-stream;

application/octet-stream 这个类型的   这个unity3d 的webgl

zipzty 发表于 2015-12-19 17:30:32

官网只有针对apache的 没有nginx的
页: [1]
查看完整版本: lnmpa中gzip 压缩问题