This stuff goes into conf.d/deflate.conf, and it's cribbed from several places on the web. Wish I could credit them, but I forgot.
If you don't use settings like this you'll find that your CSS and JS files don't get compressed, or you'll compress them all the time, even for the browsers that can't handle them, or you'll get your stuff cached by proxies that will serve the files to browsers that can't handle them, etc. I've not done totally exhaustive testing, but this is what I use on all my sites.
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0 no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# IE5.x and IE6 get no gzip, but allow 7+
BrowserMatch \bMSIE\s7 !no-gzip
# IE 6.0 after SP2 has no gzip bugs!
BrowserMatch \bMSIE.*SV !no-gzip
# Sometimes Opera pretends to be IE with "Mozila/4.0"
BrowserMatch \bOpera !no-gzip
Header append Vary User-Agent env=!dont-vary
There's an nginx equivalent around here somewhere, I'll dig it up.