Promiscuous teenagers had it rough in the ’70s and ’80s. They got butchered at summer camps, chainsawed on road trips and knifed on Halloween eve. And then 1984’s “A Nightmare on Elm Street” came along and added an unsettling dimension: You’re not even safe in your own dreams.

“A Nightmare on Elm Street,” the beloved horror flick from writer-director Wes Craven, involves a group of youngsters who are murdered by a disfigured bogeyman with the power to enter dreams. The poster promised, “If Nancy doesn’t wake up screaming she won’t wake up at all.”

The low-budget film was a surprise hit and spawned seven sequels and a 2010 reboot, racking up some $370 million in total domestic box office. Killer Freddy Krueger was named the 40th-greatest villain in history by the American Film Institute, and he has appeared in spin-off novels, video games, comic books, a 1988 TV series and as countless Halloween costumes bought last-minute at local drug stores.

The series also launched the career of Johnny Depp. He earned the role of protagonist Nancy’s boyfriend after Charlie Sheen passed on the flick, feeling it wouldn’t catch on.

Now the complete behind-the-scenes story is told in the entertaining self-published book, “Never Sleep Again: The Elm Street Legacy” by Hutson, a screenwriter and horror fanatic.

The plot of the original film reveals that Krueger (played by Robert Englund) is a child killer who escapes prosecution due to a legal technicality and is later burned alive by a mob of angry parents. He returns from the dead to haunt the dreams of youngsters living in the neighborhood.

Sounds far-fetched, but like other classic chillers, including “Psycho,” “Elm Street” has its roots in reality. The initial seed was planted after Craven read a series in the LA Times about Asian men who were literally dying from nightmares.

One man, who had terrible dreams, told his parents that he refused to go to sleep, believing he would die once he shut his eyes. He forced himself to stay awake for two days, even hiding a coffee machine in his closet, until he ultimately succumbed. His family later found him shrieking and thrashing violently in his bed — before suddenly dying.

“I just thought, wow,” Craven is quoted in the book. (Craven died in 2015.) “It literally brought tears to my eyes because here’s a guy who has a vision that’s accurate, but it’s so unusual that it seems like it’s part of some sort of madness.”

Those newspaper articles led Craven to ask: What if someone in the man’s dream had killed him? And the answer led to Freddy Krueger. Craven pieced together the iconic killer from his own life. Freddy Krueger took his first name from a bully who would beat up Craven in elementary school.

Even the villain’s costume was, in part, inspired by a creepy real-life incident when Craven was a child living in Cleveland. Lying in bed one night, Craven heard shuffling and mumbling on the sidewalk outside his second-floor apartment.

“It was a man in an overcoat and a sort of fedora hat,” Craven says. “Somehow he sensed that someone was watching, and he looked right up and into my eyes.”

Terrified, Craven retreated into his room, hoping the man would walk away. When he looked out his window again, the man was still there, staring up at Craven. When the man tried to enter Craven’s building, the future director’s older brother ran downstairs with a baseball bat—but the stranger was gone.

That horrifying experience later informed Krueger’s look (the fedora), as well as his maniacal personality and dark, quippy humor. “The thing that struck me most about that man [in Cleveland] . . . was that he had a lot of malice in his face,” Craven says. “He also had this sort of sick sense of humor about how delightful it was to terrify a child.”

Krueger’s unique knife-adorned fingers were created after Craven wondered, “What’s the earliest weapon that mankind might’ve been afraid of?” The answer: an animal’s claws. The villain’s glove was fashioned from stainless steel tomato knives made by W.R. Case and Sons Cutlery. Craven employed one person on set who did nothing but sharpen the blades during the shoot.

Freddy’s scarred face was inspired when makeup artist David Miller visited a pizzeria. While eating a slice of pepperoni pizza, he pondered how to create Freddy’s face. His dinner provided the answer.

“I did separate prosthetics on the face that represented muscle, and then over that was the outer skin layer that looked all cheesy and stretchy,” Miller says.

Audiences evidently had no problem believing it. The profits from the original “Elm Street” helped establish New Line Cinema, earning it the nickname “The Studio That Freddy Built.”