As mentioned offense is much more important than defense as your base *will* get wiped. That said, regarding base setups there are a few things I've learned that really make a difference.
First off, every defensive upgrade in EA is relatively large, with stables overall being the least important vs their GPA counterpart. Garrison upgrades give your defending infantry +1 range, bringing them to 1.5 total. This is surprisingly important for the random kills they can garner on high impact units like healers or cannons.
The castle, redoubts, and towers are primarily anti air. As such, the castle should be somewhat centralized, with towers protecting mortars and cannon towers. These will be the primary focus of IA attackers utilizing aircraft and should centralized and defended accordingly. Redoubts are also anti air, but have interesting interactions when combined with garrisons and enemy archer units. Essentially, if placed in front of a garrison you can often get archers to prioritize attacking the defending units *behind the redoubt, therefore bringing them in range to get chewed up.
Mortar and cannon towers are just basic damage upgrades, however they're such important structures that you can't afford to leave them be. Nothing fancy on this one, it's just a matter of bigger is better. Spread them out but keep mortars in range to protect eachother.
Traps are less important to upgrade than in prior ages, you won't be 1 shotting any cavalry units with them. Instead know that well placed and spread out caltrops will slow the bajeesus out of an army, and can turn relatively weak defensive points in to absolute killzones, particularly against heavy cavalry that get ahead of a main army, or a primary attack force in range of multiple mortars.
The last 2 tips go together, and regard your high hp buildings, namely mills, markets, the refinery, storehouse, and vault. You should only be guarding at most 5 of the 9 buildings, focus on gold *or* food depending on what you are upgrading next, and oil once your essential offensive upgrades are completed. Guarding the storehouse is completely optional and base layout dependant. Regardless, these are among the highest hp buildings you own, so place them to act as a buffer for defenders to spawn, mortars to fire etc.
Utilize these as best as possible and you should see a noticeable difference in your defenses
Edited: typo's.