Xdebug 502 Bad Gateway errors

I had the some problem and shared my solution here