this is really a comment on Insyte's answer, but i can't format it readably as a comment. plus this is too long for a comment :)
sed -e 's/^[[:space:]]\+\(#\|\$\)/#/' apache.conf | grep -v '^#' | uniq
using sed like this will strip out whitespace before full-line comments and before all end-of-line markers. piping through uniq will strip all but the first empty line of any sequence of consecutive empty lines (i.e. leaving one blank line between 'paragraphs'). IMO, that makes it more readable.
using uniq here does have the small risk that any other consecutive duplicate lines will be deleted, but that's not likely to be a problem in practice.
also, to answer your question about stripping single-# comments, but not double ## comments...first i'll mention that double and triple # comments are common in config files anyway so you probably want to use something else. '#:', for example. then use something like:
sed -e 's/^[[:space:]]\+\(#\|\$\)/#/' apache.conf | egrep -v '^#[^:]|#$' | uniq