For the first time spectroscopic galaxy redshift surveys are reaching the scales where galaxies can be studied together with the nearest quasars. This gives an opportunity to study the dependence between the activity of a quasar and its environment in a more extensive way than before. We study the spatial distribution of galaxies and groups of galaxies in the environments of low redshift quasars in the Sloan Digital Sky Survey (SDSS). Our aim is to understand how the nearby quasars are embedded in the local and global density field of galaxies and how the environment affects quasar activity. We analyse the environments of nearby quasars using number counts of galaxies. We also study the dependence of group properties to their distance to the nearest quasar. The large scale environments are studied by analysing the locations of quasars in the luminosity density field. Our study of the number counts of galaxies in quasar environments shows an underdensity of bright galaxies at a few Mpc from quasars. Also, the groups of galaxies that have a quasar closer than 2Mpc are poorer and less luminous than in average. Our analysis on the luminosity density field shows that quasars clearly avoid rich superclusters. Nearby quasars seem to be located in outskirts of superclusters or in filaments connecting them. Our results suggest that quasar evolution may be affected by density variations both on supercluster scales and in the local environment.