I need help.. Im too jealous.

Let me start off by saying i'm in love with him to the point where he's all I think about. I think even his flaws make him perfect. He's the most amazing man in the world. We're young, but ttc our first. We don't live together and wont until he gets back from basic, he leaves in 5 months. 
We've been engaged for 9 months. 
When we first started dating months 1-6 were all fights, cheating, lying.. On both our parts. We never had sex with someone else but we did flirt. he would say he loved other girls, ask for dirty pictures, talk sexual, say he wants to leave me, he's not happy with me, that they are prettier than me and he would be better off with them. Even tried to get back with his ex. (I didn't know about ANY of it until month 5)
I was pretty bad too. I flirted with one guy. It was only one unlike him. But i did tell this guy I loved him, i would leave my bf for him, i called him cute, we did talk sexual but pictures were never exchanged. We did kiss though (4 times) 
I told him about it right away. That was 4-5 months in. Then I found out about the other things with him. He denied it, got mad, and continued to deny it for about 2 days. He even swore on our baby. (I miscarried a week later) 
Finally I got it out of him. We fought for 2 weeks straight, breaking up every night. 8 months in, we still were bad. I was controlling, jealous, and dwelling on it. He was angry.. So we broke up for a week. During that week he checked girls out, got drunk at a party, and talked to his ex. We ended up talking it all out, and got back together. It's been a month, and we are great. We completely changed our relationship.. But i'm too jealous. I get mad and cry when I see him look at another girl. I trust him to where I don't think he will physically cheat. But mentally.. Im scared. Everytime we talk about it he swears i don't need to worry and that he changed. I believe it in his eyes but what can i do to change this? It will ruin us.