Jenkins returns 502 gateway error and (104: Connection reset by peer)
If the system recently rebooted and your proxy server is giving 502/503s, it's most likely that the backend service failed to start.

Using whatever tools are most appropriate for your OS/distro (e.g. systemctl, service/chkconfig, stop/start/restart/etc.), do the following things:


Verify that the backend (in this case Jenkins) is configured to start on boot.  Enable it if not.
Start the backend.
If the backend fails to start, check the application logs to find the source of the error.  For Jenkins on Linux, this would be /var/log/jenkins/jenkins.log.