Error 502 – Bad Gateway while accessing pages and posts

I am getting Error 502 – Bad Gateway for some URLs. Those URLs exist on my site but showing that error while other pages and posts are fine.