'Timeout when reading response headers from daemon process even after setting WSGIApplication group to Global

I am hosting a Django based webpage locally using Apache. However, I am getting the following error :

Timeout when reading response headers from daemon process 'office':var/www/office/office/wsgi.py.

I tried adding the line WSGIApplicationGroup %{GLOBAL} to the conf file, but still getting the same error.

This is my .conf file.

WSGIPythonPath /var/www/office

ServerName office.org
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so
WSGIApplicationGroup %{GLOBAL}

<VirtualHost 0.0.0.0:80>


ServerAlias www.office.org

DocumentRoot /var/www/example.com/public_html

<Directory /var/www/example.com>
Require all granted
</Directory>
<Directory /var/www/office/office>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess office python-home=/var/www/venv python-path=/var/www/office
WSGIProcessGroup office
WSGIScriptAlias /verify /var/www/office/office/wsgi.py process-group=office



ErrorLog /var/www/logs/error.log
CustomLog /var/www/logs/custom.log combined
</VirtualHost>

This is wsgi.py file:

"""

WSGI config for office project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""

import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "office.settings")
application = get_wsgi_application()



Solution 1:[1]

I've got the same problem and after a lot of struggling and trying different things, this tutorial helped me to solve the problems.

I created and successfully run the demo project. The problem for me were the paths in the config file and also using the server python version instead of creating a virtual environment for the project.

I hope it will help you

Solution 2:[2]

I have got the same problem "Timeout when reading response headers" in Flask framework

I resolved it by adding TimeOut 600 in httpd.conf/app.conf

Reference : https://ubiq.co/tech-blog/increase-request-timeout-apache/

Solution 3:[3]

if this happened on a working server, You can try to force renew Your ssl certificate. the reason could be found in apache error logs: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)

helped for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Indhumathi
Solution 3 Shahin