Join the community today
Register Now

Xenforo Brotli for XenForo 1.5.13

Discussion in 'Forum software usage' started by pdinh97qng, Mar 23, 2017.

  1. pdinh97qng

    pdinh97qng New Member

    16
    2
    3
    Jan 24, 2016
    Ratings:
    +2
    Local Time:
    11:38 AM
    o_O After read the brotli thread by eva, I realize that the result is pretty good, i want to enable it for my forum, my question is after enabled in file custom_config and rebuilt the nginx, do i have to config anything in the domain.conf to make it work?
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,956
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,418
    Local Time:
    5:38 AM
    Nginx 1.13.x
    MariaDB 5.5
    • Like Like x 1
  3. Sunka

    Sunka Active Member

    932
    243
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +394
    Local Time:
    8:38 PM
    Nginx 1.13.3
    MariaDB 10.1.24
    Also in xenforo config.php add this line too:
    Code:
    $config['enableGzip'] = false;
     
    • Like Like x 1
    • Agree Agree x 1
  4. eva2000

    eva2000 Administrator Staff Member

    30,956
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,418
    Local Time:
    5:38 AM
    Nginx 1.13.x
    MariaDB 5.5
    yeah you can do that, though i didn't have to even for Xenforo 2.0 Dev previews :)
     
    • Like Like x 2
  5. Sunka

    Sunka Active Member

    932
    243
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +394
    Local Time:
    8:38 PM
    Nginx 1.13.3
    MariaDB 10.1.24
    It is not working 100% for me and @RoldanLT until we add that into config.php
     
    • Like Like x 1
    • Informative Informative x 1
  6. eva2000

    eva2000 Administrator Staff Member

    30,956
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,418
    Local Time:
    5:38 AM
    Nginx 1.13.x
    MariaDB 5.5
    • Like Like x 2
  7. pdinh97qng

    pdinh97qng New Member

    16
    2
    3
    Jan 24, 2016
    Ratings:
    +2
    Local Time:
    11:38 AM
    thank you
     
  8. Sunka

    Sunka Active Member

    932
    243
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +394
    Local Time:
    8:38 PM
    Nginx 1.13.3
    MariaDB 10.1.24
  9. pdinh97qng

    pdinh97qng New Member

    16
    2
    3
    Jan 24, 2016
    Ratings:
    +2
    Local Time:
    11:38 AM
    @eva2000
    Code:
    [06:51][root@nitrogen.vietfriend.xyz vietfriend.xyz]# nprestart
    Restarting nginx (via systemctl):  Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
                                                               [FAILED]
    Gracefully shutting down php-fpm . done
    Starting php-fpm  done
    [07:20][root@nitrogen.vietfriend.xyz vietfriend.xyz]# nginx -t
    nginx: [emerg] unknown directive "pagespeed" in /usr/local/nginx/conf/pagespeed_vietfriend.xyz.conf:1
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
    I got this when trying with pagespeed + brotli
     
  10. eva2000

    eva2000 Administrator Staff Member

    30,956
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,418
    Local Time:
    5:38 AM
    Nginx 1.13.x
    MariaDB 5.5
    FYI, 123.08stable no longer works with ngx_pagespeed, you need to update to 123.09beta01 for ngx_pagespeed. See news thread at Nginx 1.9.11 dynamic module compatibility. 123.08stable has disabled ngx_pagespeed and lua nginx modules due to incompatibility with nginx 1.9.11 dynamic modules.

    If you want ngx_pagespeed for now you need to update Centmin Mod to 123.09beta01 outlined here Beta Branch - Centmin Mod .09 beta branch Testing

    With 123.09beta01, set in /etc/centminmod/custom_config.inc persistent config file you create or already created and set:
    Code (Text):
    NGINX_PAGESPEED=y
    NGXDYNAMIC_NGXPAGESPEED=y
    

    and then recompile Nginx 1.11.12 or higher via centmin.sh menu option 4

    Then tweak pagespeed.conf for your site and troubleshoot. Here's some links for examples and help
    1. https://centminmod.com/nginx_ngx_pagespeed.htm
    2. Nginx PageSpeed - This forum's pagespeed.conf | Centmin Mod Community
    3. Nginx PageSpeed - Nginx Pagespeed Troubleshooting steps | Centmin Mod Community
    4. Nginx, PHP-FPM & MariaDB MySQL | Centmin Mod Community
    5. Install & Upgrades or Pre-Install Questions | Centmin Mod Community
     
    Last edited: Apr 3, 2017
    • Like Like x 1
  11. pdinh97qng

    pdinh97qng New Member

    16
    2
    3
    Jan 24, 2016
    Ratings:
    +2
    Local Time:
    11:38 AM
    I'm using the latest beta on centos 7 with the custom:
    Code:
    PUREFTPD_DISABLED=n
    NGXDYNAMIC_NGXPAGESPEED='y'
    NGINX_PAGESPEED='y'
    NGXDYNAMIC_BROTLI='y'
    NGINX_LIBBROTLI='y'
     
  12. eva2000

    eva2000 Administrator Staff Member

    30,956
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,418
    Local Time:
    5:38 AM
    Nginx 1.13.x
    MariaDB 5.5
    what's output for command
    Code (Text):
    nginx -V
    

    wrapping in QUOTE tags for that output

    and contents of your nginx vhost /usr/local/nginx/conf/conf.d/vietfriend.xyz.conf and/or /usr/local/nginx/conf/conf.d/vietfriend.xyz.ssl.conf

    and contents of /usr/local/nginx/conf/pagespeed_vietfriend.xyz.conf

    wrap in CODE tags for output
     
  13. pdinh97qng

    pdinh97qng New Member

    16
    2
    3
    Jan 24, 2016
    Ratings:
    +2
    Local Time:
    11:38 AM
    ssl.conf:
    Code (Text):
    server {
        listen 45.76.158.183:80;
        server_name vietfriend.xyz www.vietfriend.xyz;
        return 302 https://www.vietfriend.xyz$request_uri;
    }
    
    server {
        listen 45.76.158.183:443 ssl http2;
        server_name www.vietfriend.xyz;
        if ($host = 'vietfriend.xyz' ) {
            return 302 https://www.vietfriend.xyz$request_uri;
        }
        add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
        #add_header Alternate-Protocol 443:npn-spdy/3;
        ssl_certificate /usr/local/nginx/conf/ssl/vietfriendxyz/ssl-unified.crt;
        ssl_certificate_key /usr/local/nginx/conf/ssl/vietfriendxyz/vietfriend_xyz.key;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_session_cache shared:SSL:30m;
        ssl_session_timeout  12h;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:AES128:AES256:AES:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK;
        ssl_prefer_server_ciphers on;
        #spdy_headers_comp 5;
        ssl_buffer_size 4000;
        ssl_session_tickets on;
        resolver 8.8.8.8 8.8.4.4 valid=10m;
        resolver_timeout 10s;
        ssl_stapling on;
        ssl_stapling_verify on;
        ssl_trusted_certificate /usr/local/nginx/conf/ssl/vietfriendxyz/ssl-trusted.crt;
    
        #include /usr/local/nginx/conf/pagespeed_vietfriend.xyz.conf;
        #include /usr/local/nginx/conf/pagespeedhandler.conf;
        #include /usr/local/nginx/conf/pagespeedstatslog.conf;
     
        ssi  on;
    
        access_log /home/nginx/domains/vietfriend.xyz/log/access.log combined buffer=32k;
        error_log /home/nginx/domains/vietfriend.xyz/log/error.log;
    
        include /usr/local/nginx/conf/autoprotect/vietfriend.xyz/autoprotect-vietfriend.xyz.conf;
        root /home/nginx/domains/vietfriend.xyz/public;
    
        location / {
            index index.php index.html index.htm;
            try_files $uri $uri/ /index.php?$uri&$args;
        }
     
        location /internal_data/ {
            internal;
            allow 127.0.0.1;
            deny all;
        }
     
        location /library/ {
            internal;
            allow 127.0.0.1;
            deny all;
        }
     
        location ~ ^/(admin.php) {
            include /usr/local/nginx/conf/php.conf;
            allow 127.0.0.1;
            allow myip;
            deny all;
        }
     
        location /install/ {
            index index.php index.html index.htm;
            allow 127.0.0.1;
            allow myip;
            deny all;
            include /usr/local/nginx/conf/php.conf;
        }
     
        #error_page 403 /403.html;
        #error_page 404 /404.html;
        error_page 504 /504.html;
     
        location = /504.html {
            access_log off;
            internal;
        }
     
        #location = /404.html {
        #    access_log off;
        #    internal;
        #}
     
        #location = /403.html {
        #    access_log off;
        #    internal;
        #}
     
        include /usr/local/nginx/conf/staticfiles.conf;
        include /usr/local/nginx/conf/php.conf;
        include /usr/local/nginx/conf/drop.conf;
        #include /usr/local/nginx/conf/errorpage.conf;
    }
    


    Pagespeed:
    Code:
    pagespeed on;
    
    pagespeed LoadFromFile "https://www.vietfriend.xyz" "/home/nginx/domains/vietfriend.xyz/public";
    
    
    pagespeed LoadFromFileRuleMatch disallow .*;
    pagespeed LoadFromFileRuleMatch allow \.css$;
    pagespeed LoadFromFileRuleMatch allow \.jpe?g$;
    pagespeed LoadFromFileRuleMatch allow \.png$;
    pagespeed LoadFromFileRuleMatch allow \.gif$;
    pagespeed LoadFromFileRuleMatch allow \.js$;
    
    pagespeed Disallow */js/dark/postrating.js*;
    pagespeed Disallow */js/xenforo/tabalerts.js*;
    pagespeed Disallow */lost-password/lost;
    pagespeed Disallow */lost-password/*;
    pagespeed Disallow */payment_callback.php*;
    pagespeed Disallow */munin/*;
    pagespeed Disallow */admincp/*;
    pagespeed Disallow */cron.php*;
    pagespeed Disallow */admin.php*;
    pagespeed Disallow */css.php*;
    pagespeed Disallow */js/jquery/jquery-1.11.0.min.js*;
    pagespeed Disallow */js/xenforo/xenforo.js*;
    pagespeed Disallow */mark-read*;
    pagespeed Disallow */forums/-/mark-read*;
    pagespeed Disallow */reply/preview*;
    pagespeed Disallow */account/alerts-popup*;
    pagespeed Disallow */conversations/popup*;
    pagespeed Disallow */conversations/*;
    pagespeed Disallow */account/alerts/*;
    pagespeed Disallow */?card*;
    pagespeed Disallow */misc/quick-navigation-menu*;
    pagespeed Disallow */misc/update-cache-ttl*;
    pagespeed Disallow */deferred.php*;
    pagespeed Disallow */forums/*;
    pagespeed Disallow */attachments/*;
    pagespeed Disallow */rgba.php*;
    pagespeed Disallow */add-reply*;
    pagespeed Disallow */edit-inline*;
    pagespeed Disallow */save-inline*;
    pagespeed Disallow */posts/*/save-inline*;
    pagespeed Disallow */posts/*/edit*;
    pagespeed Disallow */posts/*/delete*;
    pagespeed Disallow */posts/*/ip*;
    pagespeed Disallow */posts/*/report*;
    
    pagespeed MemcachedThreads 1;
    pagespeed MemcachedServers "localhost:11211";
    pagespeed MemcachedTimeoutUs 100000;
    
    pagespeed XHeaderValue "VietFriend pagespeed";
    
    pagespeed PreserveUrlRelativity on;
    pagespeed MaxCombinedCssBytes -1;
    pagespeed ImageResolutionLimitBytes 16777216;
    pagespeed EnableFilters inline_google_font_css;
    
    pagespeed AvoidRenamingIntrospectiveJavascript on;
    pagespeed ImageInlineMaxBytes 3072;
    pagespeed CssImageInlineMaxBytes 0;
    pagespeed MaxInlinedPreviewImagesIndex 6;
    pagespeed MinImageSizeLowResolutionBytes 3072;
    
    pagespeed EnableFilters elide_attributes;
    pagespeed EnableFilters dedup_inlined_images;
    pagespeed RewriteLevel CoreFilters;
    pagespeed EnableFilters collapse_whitespace,remove_comments;
    pagespeed EnableFilters prioritize_critical_css;
    pagespeed EnableFilters move_css_to_head;
    pagespeed EnableFilters move_css_above_scripts;
    pagespeed EnableFilters combine_css;
    pagespeed EnableFilters combine_javascript;
    pagespeed MaxCombinedJsBytes 140000;
    pagespeed EnableFilters rewrite_css;
    pagespeed EnableFilters rewrite_javascript;
    pagespeed EnableFilters inline_javascript;
    pagespeed EnableFilters inline_preview_images;
    pagespeed EnableFilters resize_mobile_images;
    pagespeed EnableFilters lazyload_images;
    pagespeed LazyloadImagesAfterOnload off;
    pagespeed EnableFilters rewrite_images;
    pagespeed EnableFilters convert_png_to_jpeg;
    pagespeed EnableFilters convert_jpeg_to_webp;
    pagespeed EnableFilters convert_to_webp_lossless;
    pagespeed InPlaceResourceOptimization off;
    
    pagespeed DisableFilters defer_javascript;
     
    Last edited by a moderator: Apr 4, 2017
  14. eva2000

    eva2000 Administrator Staff Member

    30,956
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,418
    Local Time:
    5:38 AM
    Nginx 1.13.x
    MariaDB 5.5
    edited your post for nginx -V output use QUOTE tags instead of CODE/CODEB tags - easier to read
    you don't have ngx_pagespeed compiled into Nginx from that output hence why you get error
    Code (Text):
    nginx: [emerg] unknown directive "pagespeed" in
    

    As per https://centminmod.com/nginx_ngx_pagespeed.html enable ngx_pagespeed instructions you need to recompile Nginx successfully with these persistent config file /etc/centminmod/custom_config.inc variables set BEFORE recompile of Nginx
    Code (Text):
    NGXDYNAMIC_NGXPAGESPEED='y'
    NGINX_PAGESPEED='y'
    

    full example at https://community.centminmod.com/th...namic-module-for-nginx-plus.10679/#post-45754
    and example when ngx_pagespeed is compiled properly, the nginx -V output looks for --add-dynamic-module=../ngx_pagespeed-1.12.34.2-beta
    maybe you tried compiling Nginx 1.11.11 or 1.11.12 with the echo nginx module bug outlined at https://community.centminmod.com/threads/nginx-announce-nginx-1-11-11.10862/. Centmin Mod 123.09beta01 later fixed that bug, so make sure you update to latest Centmin Mod 123.09beta01 code via centmin.sh menu option 23 submenu option 2 and exit centmin.sh menu before you recompile Nginx by launching a new centmin.sh run
     
  15. pdinh97qng

    pdinh97qng New Member

    16
    2
    3
    Jan 24, 2016
    Ratings:
    +2
    Local Time:
    11:38 AM
    Same issue, even trying a clean install on Centos 7 with this
    nginx is not installed
     
  16. eva2000

    eva2000 Administrator Staff Member

    30,956
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,418
    Local Time:
    5:38 AM
    Nginx 1.13.x
    MariaDB 5.5
    To troubleshoot initial installation, you need to check the initial install log at /root/centminlogs and instructions under Sharing logs and errors heading for using Pastebin.com or Gists to share a sanitised version of the contents of the initial install log. You can see full details at How to troubleshoot Centmin Mod initial install issues

    Example list /root/centminlogs files in date ascending order and grep for install.log
    Code (Text):
    ls -lahrt /root/centminlogs | grep install.log
    

    example output returns install log at /root/centminlogs/centminmod_1.2.3-eva2000.09.001_111016-112321_install.log
    Code (Text):
    ls -lahrt /root/centminlogs | grep install.log
    -rw-r--r--  1 root root 2.2M Oct 11 01:40 centminmod_1.2.3-eva2000.09.001_111016-112321_install.log
    

    in SSH use cat to ouput contents of /root/centminlogs/centminmod_1.2.3-eva2000.09.001_111016-112321_install.log. Clear your SSH client window/buffer so only output is the contents of the file
    Code (Text):
    cat /root/centminlogs/centminmod_1.2.3-eva2000.09.001_111016-112321_install.log
    

    Then copy and paste into Pastebin.com or Gists entry. If your SSH window scroll buffer isn't that large to get the whole contents of the install log, you can download file manually and copy and paste contents. But makes sure it's sanitised version of the contents of the initial install log as outlined at How to troubleshoot Centmin Mod initial install issues
     
  17. pdinh97qng

    pdinh97qng New Member

    16
    2
    3
    Jan 24, 2016
    Ratings:
    +2
    Local Time:
    11:38 AM
  18. eva2000

    eva2000 Administrator Staff Member

    30,956
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,418
    Local Time:
    5:38 AM
    Nginx 1.13.x
    MariaDB 5.5
    looks like you used the betainstaller-latest.sh which also enables Lua Nginx module and that seems to have failed to compile in Nginx for some reason
    Code (Text):
           -o objs/addon/src/ngx_http_lua_headers.o \
           ../lua-nginx-module-0.10.7/src/ngx_http_lua_headers.c
    ../lua-nginx-module-0.10.7/src/ngx_http_lua_headers.c: In function ‘ngx_http_lua_ngx_header_set’:
    ../lua-nginx-module-0.10.7/src/ngx_http_lua_headers.c:721:13: error: implicit declaration of function ‘luaL_getn’ [-Werror=implicit-function-declaration]
            n = luaL_getn(L, 3);
                ^
    cc1: all warnings being treated as errors
    make[1]: *** [objs/addon/src/ngx_http_lua_headers.o] Error 1
    make[1]: Leaving directory `/svr-setup/nginx-1.11.10'
    make: *** [build] Error 2
    
    real    3m16.429s
    user    2m43.891s
    sys    0m27.505s
    

    betainstaller-latest.sh enables additional nginx modules which normal betainstaller.sh doesn't enable like
    Code (Text):
    NGXDYNAMIC_LUA='y'
    ORESTY_LUANGINX='y'
    

    will have to test and investigate why, most of my Lua Nginx module enabled servers are fine so far.

    If you don't use Lua Nginx modules, you can edit persistent config file /etc/centminmod/custom_config.inc and set
    Code (Text):
    NGXDYNAMIC_LUA='n'
    ORESTY_LUANGINX='n'
    

    and recompile nginx via centmin.sh menu option 4

    could be related to Build broken after LuaJIT commit dc320ca · Issue #1029 · openresty/lua-nginx-module · GitHub