J. R. R. Tolkein's fantasy masterpiece The Hobbit is rife with historical references and richly described lands that are part and parcel to the backstory of the characters.
The location in the story where the dangerous, oversized spiders dwelt was the dark forest of Mirkwood, a fictional place first used by Sir Walter Scott in his novel Waverley and later appropriated by Tolkein. It occupies the Middle-Earth region known as the Wilderland and is comprised of densely packed trees that serve as perfect pockets for the hostile spiders to hide, just like that of Shelob in Tolkein's follow-up work The Lord of the Rings.
Concerning dwarves and goblins (which are synonymous with orcs), they had been fighting across the expanse of Middle Earth for millennia but perhaps most notably around the northern Misty Mountains and Mount Gundabad just west of the Grey Mountains. Gundabad was revered by dwarves but typically occupied by goblins.
In addition, both dwarves and elves were part of the Battle of the Five Armies that occurred on the Lonely Mountain (also known as Erebor) in the Third Age 2941. Goblins were specifically bred by Melkor as a mockery of the elves during a period called "The Great Darkness" and were also battling with elves across Middle Earth for millennia, but the earliest and most notable battle was at the stronghold of Utumno in Middle Earth's far north region.
The place that Tolkein refers to as the last safe place the travelers will visit before they cross the Misty Mountains is the elven town of Rivendell. This beautiful hidden refuge lies in a narrow gorge along the River Bruinen between the base of the Misty Mountain foothills and Eriador's Edge of the Wild. The safety of Rivendell largely derived from its designation as headquarters for the White Council, which was formed to confront the growing power of the evil Sauron.