  We study the properties of SDSS galaxies with and without AGN detection as a
function of the local and global environment measured via the local density,
the mass of the galaxy host group (parameterised by the group luminosity) and
distance to massive clusters. Our results can be divided in two main subjects,
the environments of galaxies and their relation to the assembly of their host
haloes, and the environments of AGN. (i) For the full SDSS sample, we find
indications that the local galaxy density is the most efficient parameter to
separate galaxy populations, but we also find that galaxies at fixed local
density show some remaining variation of their properties as a function of the
distance to the nearest cluster of galaxies (in a range of 0 to 10 cluster
virial radii). These differences seem to become less significant if the galaxy
samples are additionally constrained to be hosted by groups of similar total
luminosity. (ii) In AGN host galaxies, the morphology-density relation is much
less noticeable when compared to the behaviour of the full SDSS sample. In
order to interpret this result we analyse control samples constructed using
galaxies with no detected AGN activity with matching distributions of
redshifts, stellar masses, r-band luminosities, g-r colours, concentrations,
local densities, host group luminosities, and fractions of central and
satellite galaxies. The control samples also show a similar small dependence on
the local density indicating an influence from the AGN selection, but their
colours are slightly bluer compared to the AGN hosts regardless of local
density. Furthermore, even when the local density is held fixed at intermediate
or high values, and the distance to the closest cluster of galaxies is allowed
to vary, AGN control galaxies away from clusters tend to be bluer than the AGN
hosts. (ABRIDGED)
