I’ve struggled with this too. I had a lot of digestive issues before keto such as food intolerances/gut cramps excess gas, etc. and things mostly got better with keto. But one thing got worse which was slow irregular bowel transit time. Not full blown constipation but a slowness leading to bloating and discomfort.
I got past the worst of it by increasing electrolytes especially salt/sodium but also magnesium, potassium and calcium. But it still wasn’t good. Switching to a standing desk helped some too. Keto got me off the blood sugar roller coaster which gave me more flexibility in meal size and timing. I’ve found eating a big lunch and an early light dinner helps. A long walk in the evening or most any other physical activity helps too. When I get enough of those factors right I no longer have bloating or other digestive issues. Sometimes life gets in the way and I don’t get enough of it right and a little bloating comes back but it isn’t too distressful because I know it is temporary and I know what to do to make it right again.
Your issues and the mix of things to resolve them are likely somewhat different than mine, but look beyond ratios of fats to carbs for answers.