V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Recommended Services
Amazon Web Services
LeanCloud
New Relic
ClearDB
52txr
V2EX  ›  云计算

Nginx 的 pagespeed 模块是已经 out 了吗?我看有的帖子说是收费的?

  •  
  •   52txr · 2 天前 · 872 次点击

    debian12 想安装一直安装不上,是参考的下面这些文章:

    https://zhuanlan.zhihu.com/p/352358098 https://cn.linux-console.net/?p=9254

    7 条回复    2024-12-19 19:48:13 +08:00
    52txr
        1
    52txr  
    OP
       2 天前
    407 | if (r->headers_out.cache_control.elts == NULL) {
    | ^~~~
    /usr/local/nginx/modules/incubator-pagespeed-ngx-1.13.35.2-stable/src/ngx_pagespeed.cc:408:35: error: cannot convert ‘ngx_table_elt_t**’ {aka ‘ngx_table_elt_s**’} to ‘ngx_array_t*’
    408 | ngx_int_t rc = ngx_array_init(&r->headers_out.cache_control, r->pool,
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | |
    | ngx_table_elt_t** {aka ngx_table_elt_s**}
    In file included from src/core/ngx_core.h:66,
    from src/http/ngx_http.h:13,
    from /usr/local/nginx/modules/incubator-pagespeed-ngx-1.13.35.2-stable/src/ngx_pagespeed.h:33,
    from /usr/local/nginx/modules/incubator-pagespeed-ngx-1.13.35.2-stable/src/ngx_pagespeed.cc:26:
    src/core/ngx_array.h:32:29: note: initializing argument 1 of ‘ngx_int_t ngx_array_init(ngx_array_t*, ngx_pool_t*, ngx_uint_t, size_t)’
    32 | ngx_array_init(ngx_array_t *array, ngx_pool_t *pool, ngx_uint_t n, size_t size)
    | ~~~~~~~~~~~~~^~~~~
    /usr/local/nginx/modules/incubator-pagespeed-ngx-1.13.35.2-stable/src/ngx_pagespeed.cc:415:22: error: cannot convert ‘ngx_table_elt_t**’ {aka ‘ngx_table_elt_s**’} to ‘ngx_array_t*’
    415 | ngx_array_push(&r->headers_out.cache_control));
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | |
    | ngx_table_elt_t** {aka ngx_table_elt_s**}
    src/core/ngx_array.h:27:35: note: initializing argument 1 of ‘void* ngx_array_push(ngx_array_t*)’
    27 | void *ngx_array_push(ngx_array_t *a);
    | ~~~~~~~~~~~~~^
    /usr/local/nginx/modules/incubator-pagespeed-ngx-1.13.35.2-stable/src/ngx_pagespeed.cc: In function ‘bool net_instaweb::{anonymous}::ps_get_cache_control(ngx_http_request_t*, GoogleString*)’:
    /usr/local/nginx/modules/incubator-pagespeed-ngx-1.13.35.2-stable/src/ngx_pagespeed.cc:439:74: error: request for member ‘elts’ in ‘r->ngx_http_request_s::headers_out.ngx_http_headers_out_t::cache_control’, which is of pointer type ‘ngx_table_elt_t*’ {aka ‘ngx_table_elt_s*’} (maybe you meant to use ‘->’ ?)
    439 | auto ccp = static_cast<ngx_table_elt_t**>(r->headers_out.cache_control.elts);
    | ^~~~
    /usr/local/nginx/modules/incubator-pagespeed-ngx-1.13.35.2-stable/src/ngx_pagespeed.cc:444:59: error: request for member ‘nelts’ in ‘r->ngx_http_request_s::headers_out.ngx_http_headers_out_t::cache_control’, which is of pointer type ‘ngx_table_elt_t*’ {aka ‘ngx_table_elt_s*’} (maybe you meant to use ‘->’ ?)
    444 | for (ngx_uint_t i = 0; i < r->headers_out.cache_control.nelts; i++) {
    | ^~~~~
    make[1]: *** [objs/Makefile:1324: objs/addon/src/ngx_pagespeed.o] Error 1
    make[1]: Leaving directory '/home/lighthouse/nginx-1.27.1'
    make: *** [Makefile:10: build] Error 2
    52txr
        2
    52txr  
    OP
       2 天前
    我也试了 Nginx1.18 ,完全按照教程来。

    我只是瞎折腾,确实也不是急需的东西。如果有大佬 i 知道有什么坑,希望指点一二
    rrfeng
        3
    rrfeng  
       2 天前
    前端工程化之后这些都被前端构建做完了……(除了图像压缩之类
    skallz
        4
    skallz  
       2 天前
    不建议使用,过于老旧,带来的结果完全未知
    ranaanna
        5
    ranaanna  
       2 天前
    免费,开源。需要编译 nginx 源码启用模块。但请不要参考知乎之类。请看正规来源 https://developers.google.com/speed/pagespeed/module 。用这个模块并不需要提供付款信息,所以免费是一定的。默认有数量上的限制,1 天上限 25,000 次,100 分钟内上限 400 次。如果不够可以向 google 免费申请提高上限

    如果 debian 12 和最新 nginx mainline ,自动安装的话可以简单到
    bash <(curl -f -L -sS https://ngxpagespeed.com/install) --nginx-version latest 。手动安装似乎也不复杂

    OP 应该说一说在哪里出现问题导致“一直安装不上”
    yuedanwork
        6
    yuedanwork  
       2 天前
    https://github.com/apache/incubator-pagespeed-ngx

    status: Archived

    目前不建议服务端使用了。不管是后端实时渲染还是前端打包的产物,时下都有相应的更好的解决方案。
    52txr
        7
    52txr  
    OP
       2 天前
    @rrfeng
    @skallz
    @ranaanna
    @yuedanwork
    好嘞,感谢各位大佬的解答!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2679 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 14:51 · PVG 22:51 · LAX 06:51 · JFK 09:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.