Marine Corps Air Station Miramar is the primary location for the film. See more at http://www.miramar.usmc.mil/
The United States Navy Strike Fighter Tactics Instructor program (more commonly known as "TOPGUN" is located here). The program was created in 1969 to teach advanced areal combat maneuvers dogfighting) to skilled Navy pilots. The USN SFTI ran until 1996, when it was merged into the Naval Strike and Air Warfare Center, located in Nevada.