If you're getting a 502 error that means your back-end is not functioning properly. For jenkins these could be the reasons:
- your back end may not be starting at boot time
- Timeout may be occuring
For the first one try and run
sudo service --status-all
start the service by:
sudo service spawn-fcgi start
or
sudo /etc/init.d/spawn-fcgi start
Enable the service to start it on boot. google it
Other reason maybe a timeout error. Increase the buffer and timeout times
http {
...
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
...
}