山門 specifically refers to the main gate of a Zen temple, often a large two-story structure. 総門 is a more general term for the main gate of any temple or large estate.
正門 is the main gate of a school, company, or public facility. 総門 is used for temples and traditional estates.
Etymology
Compound of 総 (そう, 'overall, general') and 門 (もん, 'gate'). The exact historical derivation is uncertain, but the term has been used since at least the Edo period for the main entrance of temple complexes.