I used to have nightmares, almost every night, its like your something knows your worst fears and then put them in the most scariest way into your dreams and it is terrifying.
I stopped having nightmares completely after employing 2 techniques, it took me some months to master it but it just stopped them forever:
1. Be good with God. That means have a healthy relationship with God, pray several times a day, pray the holy rosary sometimes, go to mass on Sunday, be fair, love others even your enemies, etc. I am catholic so there is a lot of good help to be fair and good. Bad dreams can come from your own fears inside your brain + evil in this world, so you make sure pick the right side so you are confident and sure God got your back.
2. Use your very powerful mind you have to think about those nightmares, bad dreams, bad situations that you dream of, give them a good thought all day and rationalize it, separate facts from fiction. Also day dream, imagine those scariest situations you dream of in your nightmares and imagine you laughing at the situation, having all kinds of powers, all kinds of weapons just in the palm of your hand when you want, this way your fears will fear you instead of the other way around. Day dream a lot about this until you master your fears and laught about them, be the hero, not the victim, have fun with any situation that might come around.
You got it! Your dreams are closer to be fun instead of fearful.