There are many factors leading to nightmares, for example: your energy, thoughts, worries, events and different people you meet during living your life , tragic and stressful events, depressions, bad thoughts and memories in your subconscious, constantly eating unhealthy food, hormones etc; and whether on a conscious or subconscious level ( it happens a lot to the younger folks when they watch horror movies). What goes on with you / your emotions and factors in your life can have a big influence in your dreams as well.
can be less clueless about the subject. Trust me, it helps when you give a minimal effort for making a little research you may start the process of trying to stop your nightmares.
After you read and learn about what causes your nightmares - stop doing the thing that disturbs your sleep.
Try to clear your mind, stop having a negative thinking, do not drink heavy drinks and do not eat heavy meals.
Simply avoid all of the things that disturb your sleep and cause you to have nightmares.
Meditate to clear your mind, if you have any form of depression and stress try to get over it. Meditation is relevant to solve this kind of thing as well.
It is recommended if you feel any form of negativity around you which might be the thing that causes your nightmares. Banish any negativity or malicious spirits, make a house cleansing (for all of the rooms you have). tourmaline or hematite and amethyst are are recommended to use to avoid negativities.
I also recommend to learn making a dream catcher and a simple dream pillow (you can simply put tourmaline or hematite and amethyst under your pillow). Also, lavender is a herb which is relevant to banish negativities.
Also just telling other people about nightmares can also help a great deal to get rid of them. Talking things out helps a lot. You get rid of a lot of negative energy when doing that. Before you go to bed remind yourself it's just a dream that you might have and to help fill your head with happy thoughts try reading a book. One or two chapters a night, just enough to get the ideas of the book in your head and push out all the negative energy and your fears away.
That's all what I had to say about this subject.
But I know myself, I always forget to cover some things and my memory always misleads me :P
So Let me google this for you and get you a lot of informative articles about it :