Gzip components

This can be done on your development machine and you then transfer the files to your production environment. Or you let your production environment gzip the dynamic files on the fly just before they get delivered to the client. Apache as well as Nginx can do this for you. Apache uses the mod deflate module, Nginx has a module that is called HttpGzipModule. Gzipped html pages for example can be transferred a lot faster from server to the client.

Apache gzip (add this to your apache .conf or htaccess):


    SetOutputFilter DEFLATE
    AddOutputFilterByType DEFLATE text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript application/atom+xml
    Header append Vary Accept-Encoding
    DeflateCompressionLevel 3

Nginx gzip (add this to your nginx .conf):


    gzip  on;
    gzip_http_version 1.0;
    gzip_vary on;
    gzip_comp_level 6;
    gzip_proxied any;
    gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript application/atom+xml;
    gzip_buffers 16 8k;