Websites face Error 502 many times a day

Both websites face Error 502 many times in a day for bad gateway. It has been happening from the last 2-3 months. Please fix the problem.