I've been challenged by nightmares for a long time now, I still have them but I'm able to relax usually pretty quickly after.
Some things that helped me: good therapy, watching my coffee intake, building the habit of giving myself soothing msgs when under stress, making my bedroom safe and comforting, and using my imagination to rewrite the nightmare story.
As I wake up from a nightmare I slow my breathing down and tell myself that this too shall pass, I've survived this before and I will again, I'm alright. Then sometimes I imagine that I'm the author of the story and I go back and rewrite it. If I'm being chased or assaulted in the nightmare, I go back with support and tools, I win.