2

I am using gunicorn app.wsgi:application --bind=0.0.0.0:1312 --daemon to run a Django application in backgound .It is working on the ubuntu terminal But its not working in jenkins .Its giving 502 nginx error. nginx error.log:

(111: Connection refused) while connecting to upstream, client: 106.51.133.80, s
$.80, server: 0.0.0.0:1312, request: "GET / HTTP/1.1", upstream: "http://0.0.0.0:1312/", host: "0.0.0.0:81"
Sidhartha
  • 988
  • 4
  • 19
  • 39

1 Answers1

2

The 502 bad gateway error means that the back-end server is not functioning properly, and since it was related to Jenkins browser there could be some of the reasons:

  1. It would be related to not starting on boot time

Or

  1. Bad buffering/timeout configuration etc

For 1st case : running sudo service --status-all lists all services on the system.

After finding the service name, you can start it using

sudo service spawn-fcgi start

or

sudo /etc/init.d/spawn-fcgi start

You need to make sure that it auto starts on boot, to find that you can easily google how to make a service start on boot, it's very simple.

For 2nd case: You can try increasing the buffer as well as timeout times.

http {
...
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
...
}

For more details, please refer the below links:

Community
  • 1
  • 1
dildeepak
  • 1,349
  • 2
  • 16
  • 34