如何修复" Timeout when reading response headers from daemon process" WSGI与Django和Apache一起使用时的错误



我已经安装了django并使用以下命令创建了一个新项目:

mkdir trydjango
cd trydjango
virtualenv -p python3 .
source bin/activate
pip install django==2.0.7

运行pip freeze时,我会看到以下内容:

Django==2.0.7
pkg-resources==0.0.0
pytz==2018.9

在我的VirtualHost内部,我有以下内容:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName django.mydomain.com
    ServerAlias www.django.mydomain.com
    DocumentRoot /var/www/django.mydomain.com
    ErrorLog ${APACHE_LOG_DIR}/django.mydomain.com.error.log
    CustomLog ${APACHE_LOG_DIR}/django.mydomain.com.access.log combined

    <Directory root/Dev/trydjango/src/trydjango>
           <Files wsgi.py>
                 Require all granted
           </Files>
        </Directory>
    WSGIApplicationGroup %{GLOBAL}
    WSGIDaemonProcess trydjango python-home=root/Dev/trydjango/bin python-path=root/Dev/trydjango/
    WSGIProcessGroup trydjango
    WSGIScriptAlias / /root/Dev/trydjango/src/trydjango/wsgi.py
</VirtualHost>

但是,当我尝试访问我的域时,它会耗尽。当我访问域的apache错误日志时,存在以下错误消息:

[PID 12746] [客户xx.xx.xx.xxx:60684]读取响应时超时 守护程序过程" Trydjango"的标题: /root/dev/trydjango/src/trydjango/wsgi.py

我该如何解决此超时问题?

我已经把wsgi.py chot到www-data:我还将该应用程序置于Exectuable

不确定该全新项目还可以尝试什么才能使WSGI工作。

我找到了以下内容:django webfaction'读取守护程序进程的响应标头的超时'

并将WSGIApplicationGroup %{GLOBAL}添加到VirtualHost以及Apache2.conf中,但这并没有解决问题。

我只是解决了这样的问题,但是widht blask-wsgi,我认为是相同的。读取守护程序流程的响应标头的超时&quot&quot只需转到文件夹"/etc/httpd/conf.d/"(在Centos中),在Python-wsgi的配置文件中

听5002&lt; VirtualHost 192.168.150.62:5002>

ServerAdmin webmaster@localhost
#DocumentRoot /var/www/html
DocumentRoot /home/XXXXXXx/XXXXXXXXX
ServerAlias XXXXXXXXXXXXXX
ServerName XXXXXXXXXXXXXXX
LogLevel debug
WSGIDaemonProcess xxxxxxxxxxxxxxxxx python-path=/home/XXXXX/XXXXXXXXXX:/home/XXXXXX/XXXXXXXXX/venv/lib/python3.6/site-packages
WSGIProcessGroup XXXXXXXXXXXXXXX
WSGIScriptAlias / /home/XXXXX/XXXXXXXXXXXXX/app.wsgi 
WSGIPassAuthorization On
WSGIChunkedRequest On
ErrorLog logs/error-5000-dev.log
CustomLog logs/access-5000-dev.log combined
<Directory /home/XXXXX/XXXXXXXXXXXXXXX>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
</Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/XXXXXX.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/xxxxxxxx.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/xxxxxxxxx.com/chain.pem
SetEnv nokeepalive ssl-unclean-shutdown
TimeOut 18000

看,我放了一个设定的属性"超时"在文件的决赛中,我在18000测试中投入了大量的第二次,当然,您必须重新启动服务Apache," Service httpd restart"。变更之后。默认情况下,如果您不触摸它,则为60秒。尝试那a,告诉我您是否解决了问题。好运。!

最新更新