How do I turn on gzip in Apache2?

Solution 1:

sudo ln -s /etc/apache2/mods-available/deflate.load /etc/apache2/mods-enabled/

and restart apache

sudo /etc/init.d/apache2 restart

Solution 2:

Debian/Ubuntu have the a2* set of scripts for managing modules and vhosts. You can use a2enmod:

$ sudo a2enmod deflate
Enabling module deflate.
Run '/etc/init.d/apache2 restart' to activate new configuration!
$ sudo /etc/init.d/apache2 restart
 * Restarting web server apache2
 ... waiting                                                             [ OK ]
$