Can sex cause miscarriage?

Ash
I'm so nervous to do anything that could cause a miscarriage, I have recently had one and I'm scared it will happen again. Is there anything that can cause miscarriage or things I should avoid doing. Is sex safe? Help!