Gateway Timeout - The gateway did not receive a timely response from the upstream server or application when running under apache

My django server implements REST API's for excel operations so that user can upload/download data from/to django server's database. Those upload/download-operations take 20-50 minutes and everything works when started my django-server using manage.py runserver. But when executed under apache those may finish for Gateway Timeout The gateway did not receive a timely response from the upstream server or application and log message: Timeout when reading response headers from daemon process 'pxpro_wsgi': /srv/django/pxpro/settings/wsgi.py.

<VirtualHost *:80>
  ServerAdmin palvelin.hallinta@<myorg>.fi
  ServerName tkpyapps01p.ad.<myorg>.fi


  ErrorLog /var/log/httpd/pxpro-error_log
  CustomLog /var/log/httpd/pxpro-access_log combined

  LogLevel warn

  HostnameLookups Off
  UseCanonicalName Off
  ServerSignature Off
  RequestReadTimeout header=15-150,MinRate=250 body=30-3600,MinRate=150

  <IfModule wsgi_module>
    WSGIDaemonProcess pxpro_wsgi user=django group=django home=/srv/django python-home=/srv/django/pxpro-env-3.9 python-path=/srv/django/pxpro processes=16 threads=1 maximum-requests=20000 display-name=%{GROUP} connect-timeout=1200 socket-timeout=1200 queue-timeout=1200 response-socket-timeout=1200 request-timeout=1200 inactivity-timeout=1200 header-buffer-size=1073741824
     WSGIProcessGroup pxpro_wsgi
     WSGIApplicationGroup pxpro_wsgi
     WSGIScriptAlias / /srv/django/pxpro/settings/wsgi.py process-group=pxpro_wsgi application-group=pxpro_wsgi
  </IfModule>

  <Directory "/srv/django/pxpro/settings">
    <Files wsgi.py>
      Require all granted
    </Files>
    Require all denied
  </Directory>

  <Location "/">
    Options Indexes Includes FollowSymlinks
  </Location>

</VirtualHost>

How to fix ?

Back to Top