Looks like it is a problem with IIS. Did you configure CB right?
Gateway is in networking terms the location thru which communications go towards the Internet...
I was able to fix the Error 502 Bad Gateway error message by upgrading my PHP version. Immediately on upgrade was able to access the configuration page for community builder.
This error is a known problem for PHP 4 and fopen and exists on many php based apps (a google search on the error will show many apps with same problem). Not a community builder issue.
I am running on PHP Version 5.2.0. Is this the most current version? I am having this same problem and don't want to edit the config file if possible. Please help.