Compression is a much used and abused effect in modern music. On the one hand, it is the glue that sticks the instruments together, on the other hand, it removes the dynamic range and life out of music if done badly. It is essential in almost every mix to tame a big transient. If you don't reduce the dynamic range a bit, you cannot turn the overall track volume up without the peaks having higher chance of clipping. The issue is how to get the right level?
The first thing to do if you want to prevent overdoing it, is to overdo it. Listen to the track and consider what it needs first. When you slap on a compressor, you will have a better idea of what you want to do with it.
Set the compressor to compress way harder than is needed and then slowly dial the controls back to when it sounds full of life again. Hopefully it will start to fill with life before you stop actually compressing the track.
If a signal is being overdriven, it is already compressing. Overdrive stops the peaks going any higher than the threshold but, instead of reducing the volume, it just snips the top off the waveform. This causes harmonics and is not good for transparent compression however, if you want to add a bit of grit, and can sacrifice the quality then consider using a very gentle overdrive, applied with a valve amp simulator.
Sometimes how hard the compressor kicks in makes a difference, consider switching from hard knee to soft knee for a smoother compression, be aware that the compressor does start to kick in before the threshold.
Try New York or Parallel Compression, especially on drums. This is where you compress one signal and you mix in an identical uncompressed signal to the output so you get the best of both worlds.
In the end, the best way to learn how to make a compressor rock is to practice and watch other people do it. Look on Youtube for videos of people mixing and see when and where they use the compressor and listen to how it makes it much better.