免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1929 | 回复: 1
打印 上一主题 下一主题

[Web] nginx ngx_pagespeed模块的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-07-10 10:54 |只看该作者 |倒序浏览
本帖最后由 big_turnip 于 2013-07-10 11:33 编辑

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

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

论坛徽章:
0
2 [报告]
发表于 2013-07-10 14:05 |只看该作者
好吧,我自己找到解决的方法了
在主站的nginx server配置文件里面加
pagespeed Domain  http://副域名;
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的资料都是英文的,看起来有压力呐
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP