Configuring `mod_deflate` in Apache involves several steps.
1. Load the Module: First, you need to make sure the `mod_deflate` module is loaded into your configuration. Add this line to your httpd.conf or apache2.conf file:
```
LoadModule deflate_module modules/mod_deflate.so
```
1. Configure Deflate Module: Once the module has been loaded, you can configure it in your .htaccess file or directly in your httpd.conf or apache2.conf file. Here is a basic configuration:
```
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0 no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
```
This configuration tells the deflate module to compress the output of the listed MIME types. The “BrowserMatch” directives are used to work around known bugs in certain browsers.
1. Restart Apache: Lastly, make sure you restart your Apache server for the changes to take effect. Use the command `sudo service apache2 restart` or `sudo systemctl restart httpd` depending on your server.
Remember to firstly check if `mod_deflate.so` is located the directory you specify before you load it. Also, enable `mod_headers` if `Header append Vary User-Agent` line doesn’t work.