4
Your rating: None Average: 4 (1 vote)

In my work Apache can play a big part of the web serving chain, especially for most PHP based sites (like Drupal). Here are tips I've collected along the way. Of course YMMV (your mileage may vary).

Conf settings

These settings can be placed inside various places, the best would be in the *.cnf file for your domain or site. At worst this stuff can go inside httpd.conf which is the global configuration file for Apache.

Compress output of common text based files

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/js
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE application/x-httpd-eruby
AddOutputFilterByType DEFLATE text/html

... or in a shorter way...
AddOutputFilterByType DEFLATE text/plain text/xml application/xhtml+xml text/css text/javascript text/js application/xml image/svg+xml application/rss+xml application/atom_xml application/x-javascript application/x-httpd-php application/x-httpd-fastphp application/x-httpd-eruby text/html

Remove ETags

Header unset ETag
FileETag None

Easy changes

  • Disable or remove any extensions not used (like mod_perl if you only are using PHP).
  • Consider moving configuration overrides from .htaccess file(s) into *.cnf files

Tags: Apache, httpd