I had a quick look at several maps (such as the ones below, taken from the Encyclopedia of Arda website and Karen Wynn Fonstad's Atlas of Middle-earth respectively), and all seemed to indicate that Osgiliath was somewhere between fifteen and twenty miles from Minas Tirith according to the lore. You certainly couldn't ride between the two in five minutes. As for being in the shadow of Mordor, the Ephel Dúath, the western mountains of Sauron's land were little more than twenty miles to the east of Osgiliath.
In Peter Jackson's film adaptation, it does appear that this distance was shortened considerably for dramatic effect, rather than getting the scale wrong (the fields of the Pelennor were also dotted with fields and farmsteads, and were not as open and barren as The Return of the King film suggests).
Another example of geographical poetic license would be Aragorn, Legolas and Gimli exiting the Paths of the Dead and appearing near Pelargir, whereas in the books, they found themselves in the Vale of Morthond, about three hundred miles to the northwest.
A further example of the journey being shortened in order to tell the story on film is seen, or rather not seen, in The Fellowship of the Ring. In the film, we see the Hobbits travelling through the Shire, and then in the next scene arriving at the western gate of Bree. As those who have read the books will know, they took a diversion through the Old Forest on the way, to avoid the Black Riders, and had to contend with an angry sentient tree and an evil spirit, whilst meeting a merry fellow and his nature-loving partner in between.