Military route can be a bit tricky and sometimes takes a lot of luck as well.
You really need to place your cities in strategic places with natural boundaries.
When the time for war comes you should designate large groups of units stationed in your cities, at the borders to defend, and ready to attack when you declare war or suspect another group of declaring war on you.
Allies are important in a military victory, so you should build good relationships with the stronger civilizations early on, once you have conquered your enemies alongside your allies you should be powerful and industrious enough to wipe them out as well.
It is one of the harder victories but also one of the most rewarding.