A literary setting refers to the landscape and the people/characters that fill it.
The setting is the signature of many a writer: Stieg Larsson and Sweden (The Girl with the Dragon Tattoo), Annie Rice and New Orleans (Interview with a Vampire), John le Carre, the world of spies.
Writing what you know
It is often said you should “write what you know”. A sensible approach, especially for the new writer. By placing your characters in scenes and situations with which you are familiar, you are more likely to invest a sense of realism in the story. Also, practically speaking, writing about familiar territory will save on research you might otherwise have to do on a subject/setting.
Some writers resist writing what they know as they feel their own environments are not “glamorous” or “extraordinary” enough to merit such attention. This is nonsense. Whatever you do and whoever you are, your life will seem exotic to someone else. The fact that you grew up on a council estate/project developent in Bolton/Kalamazoo is interesting to someone living on a farm in Siberia. Remember, the life of an immigrant taxi-driver would quite likely fascinate the Queen of England.
Also, you don’t necessarily have to set your story in your street or your workplace. Think of your Saturday morning football team, your chool, the nightclubs you frequent, a hospital you’ve spent time in or a prison. All are equally valuable settings for a short story, novel, play, film script or even poem or song. Your environment is your gold, mine it.
But I don’t want to write about my environment…
That’s fine too. There is also case for “writing what you don’t know”. Fantasy writers, for example, are (usually) not elves living in Middle Earth. Historical fiction writers have not lived in Tudor England. Yet, Fantasy/SciFi/Historical novels are written and enjoyed every year. For Fantasy/SciFi you need a familiarity with the genre and a vivid imagination. For historical fiction you need to like research. For all the above you’ll require the ability to convincingly create an unfamiliar world.
Bear in mind, however, that while a Fantasy writer won’t get complaints from angry elves about his misinformed stereotypes. A novelist who sets a story in a modern French monastery, and knows nothing about France or monks – is asking for trouble. Firstly, their prose may be riddled with (skewed) perceptions of France and the French, monks/Catholicism/wine-making etc… And not only is there danger of rehashing clichés, their writing might lack the detailed realism a reader finds so reassuring and intriguing.
So, if you want to write about banditos in the mountains of Sardinia, and you can’t go and live there for a year – then research, research, research. Read as much as you can on the topic, as well as any other fiction that has used the same environment as a setting.