MRatWork Forum by Mustafa Ramadhan

Sawo Project - Kloxo-MR Discussions => Kloxo-MR Technical Helps => Topic started by: rsakhale on 2017-05-04, 11:25:34

Title: Enabling Apache Deflate and PageSpeed module the right way
Post by: rsakhale on 2017-05-04, 11:25:34
After reading a lot post here, I am still confused and not able to identify if gzip is actually working or not.

Steps I followed

After testing with gtmetrix.com - https://gtmetrix.com/reports/pharmaindigital.com/rgkCfgHm

I still see gzip is not installed, could you please help understand what we are missing.

Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: MRatWork on 2017-05-04, 12:11:00
Inform here 'sh /script/sysinfo' in every asking. It's because different condition between version (6.5 vs 7.0) and update (in 7.0).
Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: rsakhale on 2017-05-04, 12:19:39
Using Kloxo-MR 7.0.0.c-2017050104

Code: [Select]
A. Control Panel:
   - Kloxo-MR: 7.0.0.c-2017050104
   - Web: hiawatha-10.6.0-f.1.mr.el6.x86_64
   - PHP: php56s-5.6.30-2.ius.centos6 (fpm mode)
B. Plateform:
   - OS: CentOS release 6.9 (Final) x86_64
   - Hostname: pharmaindigital.com
C. Services:
   1. MySQL: MariaDB-server-10.0.30-1.el6.x86_64
   2. PHP:
      - Installed:
        - Branch: php70w-cli-7.0.18-1.w6.x86_64
        - Multiple:
          * php56m-5.6.30-2.ius.centos6
          * php70m-7.0.18-1.ius.centos6
          * php71m-7.1.4-1.ius.centos6
      - Used: php70m-fpm
      - Multiple: enable
   3. Web Used: apache
     - Hiawatha: hiawatha-10.6.0-f.1.mr.el6.x86_64
     - Lighttpd: lighttpd-1.4.45-1.el6.x86_64
     - Nginx: nginx-1.13.0-1.el6.ngx.x86_64
     - Apache: httpd24u-2.4.25-3.ius.centos6.x86_64
       - PHP Type: php-fpm_worker
       - Secondary PHP: off
   4. WebCache: none
     - ATS: --uninstalled--
     - Squid: --uninstalled--
     - Varnish: --uninstalled--
   5. Dns: bind
     - Bind: bind-9.9.9-1.mr.el6.x86_64
     - DJBDns: djbdns-1.05-17.4.mr.el6.x86_64
     - NSD: nsd-4.1.14-1.el6.x86_64
     - PowerDNS: pdns-4.0.3-1.el6.MIND.x86_64
     - Yadifa: yadifa-2.2.3-1.mr.el6.x86_64
   6. Mail: qmail-toaster-1.03-1.3.56.mr.el6.x86_64
      - pop3/imap4: courier-imap-toaster-4.1.2-1.3.20.mr.el6.x86_64
      - smtp: qmail-toaster-1.03-1.3.56.mr.el6.x86_64
      - spam: bogofilter-1.2.4-1.el6.x86_64
   7. FTP: pure-ftpd
      - pure-ftpd: pure-ftpd-1.0.37-1.mr.el6.x86_64
   8. Stats: awstats
      - awstats: kloxomr-stats-awstats-7.6-1.mr.noarch
D. Memory:
             total       used       free     shared    buffers     cached
Mem:          3831       1520       2311         18        106        424
-/+ buffers/cache:        989       2842
Swap:         3967         46       3921
E. Disk Space:
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/vg-root   54G  5.3G   46G  11% /


*** Process Time: 00:00:00:51.51505 (dd:hh:mm:ss:xxxxxx) ***

* Note: run 'sh /script/sysinfo -y' if you want run 'fix-service-list' also
        (importance after Kloxo-MR update)
Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: MRatWork on 2017-05-04, 12:23:26
Go to 'admin > switch programs' and then set 'enable pagespeed'.
Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: rsakhale on 2017-05-04, 12:42:33
Have already done that, pagespeed is enabled and it is seen in output, but gzip is still not enabled.
Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: MRatWork on 2017-05-04, 13:13:13
Make sure copy '/opt/configs/apache/etc/conf.d/pagespeed.conf' to '/etc/httpf/conf.d/pagespeed.conf'. And then run 'sh /script/restart-web'.
Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: rsakhale on 2017-05-04, 13:25:43
Done, copied the config's file as your said above and performed restart  and also fix-all

After testing with gt-metrix - https://gtmetrix.com/reports/pharmaindigital.com/xnQXP4Ju

It still says gzip not enabled
Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: fossxplorer on 2017-05-04, 13:42:56
Reason is this line:
[root@mail ]# cat -n /opt/configs/apache/tpl/defaults.conf.tpl| grep deflate
    61         exec("sed -i 's/^LoadModule deflate_module/#LoadModule deflate_module/' {$trgtcmdpath}/00-base.conf");

@mustafa, i think he should create  /opt/configs/apache/tpl/custom.defaults.conf.tpl where that line is commented out, then remove the uncomment it from:
[root@mail ]# cat -n /etc/httpd/conf.modules.d/00-base.conf| grep deflate
    30   #LoadModule deflate_module modules/mod_deflate.so

Finally run  sh /scripts//restart-web  ;)


@mustafa, i think i make sense to disable deflate_module when Apache is behind a proxy(Nginx or Hiawatha proxy) since at least Nginx proxy does it:
[root@mail linuxwonders]# grep -ri 'gzip on' /opt/configs/nginx/conf/*
/opt/configs/nginx/conf/globals/gzip.conf:   gzip on;  ;)
 
Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: fossxplorer on 2017-05-04, 13:50:23
@rsakhale, why are you not using any reverse proxy (Nginx or Hiawatha reverse proxy) in front of Apache?
You would get better performance from such setup, at least with Nginx proxy due to better caching.

If you do that, your gzip problems will be solved too!  ;)
Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: rsakhale on 2017-05-04, 14:06:19
@fossxplorer I tried commenting the line in 00-base.conf still no success

Could you please help me by telling the steps in Kloxo-MR to configure reverse proxy as Nginx/Hiawatha
Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: MRatWork on 2017-05-04, 14:12:07
I think something wrong with gtmetrix. Information from header look like OK:
Code: [Select]
Date: Thu, 04 May 2017 06:47:38 GMT
Server: Apache/2.4.25 (CentOS)
X-Content-Type-Options: nosniff
x-xss-protection: 1;mode=block
x-frame-options: SAMEORIGIN
Access-Control-Allow-Origin: *
X-Supported-By: Kloxo-MR 7.0
Strict-Transport-Security: max-age=2592000; preload
Upgrade: h2
Connection: Upgrade, close
Accept-Ranges: bytes
X-Mod-Pagespeed: 1.11.33.4-0
Cache-Control: max-age=0, no-cache, must-revalidate
Vary: Accept-Encoding,Cookie
Content-Encoding: gzip
Content-Length: 18396
Content-Type: text/html; charset=UTF-8
Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: fossxplorer on 2017-05-04, 14:13:08
You need to UNCOMMENT it so that line should look like:
LoadModule deflate_module modules/mod_deflate.so
And you must restart httpd, e.g with restart-web. Did you do that?

Setting up reverse proxy in Kloxo-MR is simple:
Go to "Switch Program" as admin and choose e.g nginxproxy under Web and then click Update.
That should be it. If you do this, then don't worry about deflate with Apache. Nginx reverse proxy does gzip by default in Kloxo-MR!




@fossxplorer I tried commenting the line in 00-base.conf still no success

Could you please help me by telling the steps in Kloxo-MR to configure reverse proxy as Nginx/Hiawatha
Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: MRatWork on 2017-05-04, 14:14:27
BTW, try change value to '-1' for 'Static Files Expire (in days; -1 to disabled; 0 to reset)' in 'web features' for certain domain.
Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: MRatWork on 2017-05-04, 14:16:58
No. If you enable pagespeed, deflat also enable (see /etc/httpd/conf.d/pagespeed.conf'.

By default, deflat set as disabled.
Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: fossxplorer on 2017-05-04, 14:19:30
Yes, @mustafa is right. You already have gzip enabled (because of pagespeed as mustafa writes):
root]$ curl -H "Accept-Encoding: gzip" -I https://pharmaindigital.com/
HTTP/1.1 200 OK
Date: Thu, 04 May 2017 06:53:53 GMT
Server: Apache/2.4.25 (CentOS)
X-Content-Type-Options: nosniff
X-XSS-Protection: 1;mode=block
X-Frame-Options: SAMEORIGIN
Access-Control-Allow-Origin: *
X-Supported-By: Kloxo-MR 7.0
Strict-Transport-Security: max-age=2592000; preload
Upgrade: h2
Connection: Upgrade, close
Accept-Ranges: bytes
X-Mod-Pagespeed: 1.11.33.4-0
Cache-Control: max-age=0, no-cache, must-revalidate
Vary: Accept-Encoding,Cookie
Content-Encoding: gzip
Content-Length: 18340
Content-Type: text/html; charset=UTF-8

Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: MRatWork on 2017-05-04, 14:22:49
Cache are enable in nginx and hiawatha by default. It's because implementing microcache for them. Micro-cache doesn't work under apache and lighttpd (or no effect for micro-cache setting).
Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: rsakhale on 2017-05-04, 16:25:11
Thanks, @mustafa, and @fossxplorer for your support, gzip was already enabled after adding page speed, the problem was with WordPress minification plugin that caused the main trouble.

The speed of website has greatly improved, thanks a lot, guys.
Title: Re: Enabling Apache Deflate and PageSpeed module the right way
Post by: amitkumar on 2018-02-08, 12:30:35
Reason is this line:
[root@mail ]# cat -n /opt/configs/apache/tpl/defaults.conf.tpl| grep deflate
    61         exec("sed -i 's/^LoadModule deflate_module/#LoadModule deflate_module/' {$trgtcmdpath}/00-base.conf");

@mustafa, i think he should create  /opt/configs/apache/tpl/custom.defaults.conf.tpl where that line is commented out, then remove the uncomment it from:
[root@mail ]# cat -n /etc/httpd/conf.modules.d/00-base.conf| grep deflate
    30   #LoadModule deflate_module modules/mod_deflate.so

Finally run  sh /scripts//restart-web  ;)


@mustafa, i think i make sense to disable deflate_module when Apache is behind a proxy(Nginx or Hiawatha proxy) since at least Nginx proxy does it:
[root@mail linuxwonders]# grep -ri 'gzip on' /opt/configs/nginx/conf/*
/opt/configs/nginx/conf/globals/gzip.conf:   gzip on;  ;)


Worked for me