How do you know that quasars are not just nearby stars?

The light from quasars - all quasars - is shifted far to the red side of the spectrum. This means that they are moving away from us, at a very high rate of speed. They cannot be "nearby", for that, and a lot of other sound, scientific reasons.