Discuss your project
Apache

Apache: Enable compression

To enable compression in Apache, you have two options; The first is to insert the directives into the .htaccess file, and the second is to place these directives directly in the declaration of your vhost. <ifModule mod_gzip.c> mod_gzip_on Yes...

Apache: Enable compression

To enable compression in Apache, you have two options;
The first is to insert the directives into the .htaccess file, and the second is to place these directives directly in the declaration of your vhost.

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

``` Please replace `
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

Compatibility context

This procedure documents a PHP or Apache environment from its time. PHP 5.x and 7.x branches no longer receive standard support from the PHP project: do not deploy this configuration as is on a new server.

  • First identify the versions actually installed and the loaded modules.
  • Prepare a configuration backup and a rollback procedure.
  • Validate the syntax, then the critical paths, on a version of PHP that is still maintained.

Reference: currently supported PHP versions.

Share this article