big_turnip 发表于 2013-07-10 10:54

nginx ngx_pagespeed模块的问题

本帖最后由 big_turnip 于 2013-07-10 11:33 编辑

在nginx上面配置了ngx_pagespeed模块
nginx上面有做动静分离,静态的放在副域名上面
但是若是从主域名访问网站,调用副域名上的图片的时候没有看到用pagespeed重写的痕迹
若是从副域名直接访问网站,则可以看到图片被pagespeed重写

主站上面有做规则重写,但是我有在主站上面加入if ($request_uri ~ "(ngx_pagespeed_([^.]+)/(.*)?)") {
                break;
      }
顺便问下这个github上面的ngx_pagespeed项目跟google是什么关系
为什么是在github上面,而不是在google code上面

big_turnip 发表于 2013-07-10 14:05

好吧,我自己找到解决的方法了
在主站的nginx server配置文件里面加
pagespeed Domainhttp://副域名;
Nginx:
pagespeed Domain http://example.com;
pagespeed Domain cdn.example.com;
pagespeed Domain http://styles.example.com/css;
pagespeed Domain *.example.org;
PageSpeed will rewrite resources found from these explicitly listed domains, although in the case of styles.example.com only resources under the css directory will be rewritten. Additionally, it will rewrite resources that are served from the same domain as the HTML file, or are specified as a path relative to the HTML. When resources are rewritten, their domain and path are not changed. However, the leaf name is changed to encode rewriting information that can be used to identify and serve the optimized resource.

The leading "http://" is optional; bare hostnames will be interpreted as referring to HTTP. Wildcards can be used in the domain.
目前关于ngx_pagespeed的资料都是英文的,看起来有压力呐
页: [1]
查看完整版本: nginx ngx_pagespeed模块的问题