Jump to content

how do you serve compressed gzip of js and css


sasiko

Recommended Posts

Posted

like how this site is doing using amazon cloudfront. can you do it via servers aswell? the latency are said to improve if you serve via .gz

 

Quote

Before serving a file from disk to a gzip-enabled client, this module will look for a precompressed file in the same location that ends in ".gz". The purpose is to avoid compressing the same file each time it is requested.

 

Posted

IPS4 will check to see if your server has it enabled and able to compress it then it will server gzip enabled files. If you aren't able to, please contact your hosting provider to ensure that your server is able to.

Posted

hi, thanks for your reply.

i run nginx and have this in server block

but it doesnt generate .gz

  location ~* /forum/uploads/(css|js)$ {
        access_log off;
        gzip_static on;
        expires    max;
        add_header ETag "";
        add_header Cache-Control "max-age=31449600, no-transform, public";
        add_header Content-Encoding  gzip;
        try_files    $uri $uri/ /forum/uploads/index.php; 
}

perhaps i did something wrong?

 

HTTP/1.1 200 OK
Server: nginx
Date: Sat, 09 Jul 2016 03:22:06 GMT
Content-Type: application/javascript
Content-Length: 324558
Last-Modified: Sat, 09 Jul 2016 02:58:56 GMT
Connection: keep-alive
Vary: Accept-Encoding
ETag: "57806870-4f3ce"
Expires: Sun, 09 Jul 2017 03:22:06 GMT
Cache-Control: max-age=31536000
X-Content-Type-Options: nosniff
Accept-Ranges: bytes

 

:method: GET
:scheme: https
:path: /forum/uploads/javascript_global/root_library.js.2f5d9c82956b1f5f3d21dd159f611a25.js?v=95f8d25421
user-agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36 PTST/285
accept: */*
referer: https://domainforum/login/?ref=aHR0cHM6Ly95dW9ubWFpLm1lL2ZvcnVtL211c2ljYm94Lw%3D%3D
accept-encoding: gzip, deflate, sdch, br
accept-language: en-US,en;q=0.8
cookie: ips4_IPSSessionFront=fhgo5e0b66ab8mdj8a9p45aqt0
content-encoding: gzip

 

1 hour ago, Jim M said:

IPS4 will check to see if your server has it enabled and able to compress it then it will server gzip enabled files. If you aren't able to, please contact your hosting provider to ensure that your server is able to.

 

Posted

@Jim MMy server do have gz enabled But my forum still failed to generate js/css.gz. what am i doing wrong?

i created my own css.gz compressed file and it could open the css file just fine.

>curl -H "Accept-Encoding: gzip" -I mydomain.com/css.gz
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 09 Jul 2016 18:02:26 GMT
Content-Type: text/css
Content-Length: 5353
Last-Modified: Sat, 09 Jul 2016 17:55:47 GMT
Connection: keep-alive
ETag: "57813aa3-14e9"
Expires: Sun, 09 Jul 2017 18:02:26 GMT
Cache-Control: max-age=31536000
Content-Encoding: gzip
Accept-Ranges: bytes
 

Posted

@Jim M

again my server fulfills every critera that it can support.gz compression you can even test my static css that i linked on support ticket. the header content clearly say gzip 

System Check

PHP Requirements

  • PHP version 5.6.22.
  • cURL extension loaded.
  • Multibyte String extension loaded
  • DOM extension loaded
  • GD extension loaded
  • MySQLi extension loaded
  • OpenSSL extension loaded
  • Session extension loaded
  • SimpleXML extension loaded
  • XML extension loaded
  • XMLReader extension loaded
  • XMLWriter extension loaded
  • Phar extension loaded
  • Zip extension loaded
  • 700 MB memory limit.

File System Requirements

  • /home/yuon/domains/public_html/forum/applications is writable
  • /home/yuon/domains/public_html/forum/plugins is writable
  • /home/yuon/domains/public_html/forum/uploads is writable
  • /home/yuon/domains/public_html/forum/downloads is writable
  • /home/yuon/domains/public_html/forum/screenshots is writable
  • /home/yuon/domains/public_html/forum/uploads/logs is writable

MySQL Requirements

  • MySQL version 5.5.5-10.1.14-MariaDB.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...