Веб-приложение Python Flask с mod_wsgi Журнал ошибок Не удалось прокси-ответ клиенту - PullRequest
0 голосов
/ 11 октября 2018

Я проверил журнал ошибок приложения Flask. Я нашел ошибку, как показано ниже.

[Thu Oct 11 06:46:46.126464 2018] [wsgi:error] [pid 3175:tid 140377306687232] (70007)The timeout specified has expired: [client 137.97.88.45:43530] mod_wsgi (pid=3175): Failed to proxy response to client.

У меня есть флеш-роутер Python.Это занимает некоторое время, чтобы обработать данные для каждого запроса в зависимости от обрабатываемых данных.

Файл конфигурации Flask и файл конфигурации wsgi

#!/usr/bin/python3.6
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/FlaskApp/")
sys.path.append("/var/www/FlaskApp/FlaskApp/src")
from FlaskApp import app as application

Ниже приведен файл конфигурации Wsgi

<VirtualHost *:80>
                ServerName domain
                ServerAlias www.domain.com
                ServerAdmin youremail@email.com
                WSGIDaemonProcess FlaskApp user=www-data group=www-data threads=5
                WSGIProcessGroup FlaskApp
                WSGIScriptAlias / /var/www/FlaskApp/FlaskApp.wsgi
                <Directory /var/www/FlaskApp/FlaskApp/>
                        Order allow,deny
                        Allow from all
                </Directory>
                ErrorLog ${APACHE_LOG_DIR}/FlaskApp-error.log
                LogLevel warn
                CustomLog ${APACHE_LOG_DIR}/FlaskApp-access.log combined
</VirtualHost>

файл конфигурации apache

# Global configuration
#ServerRoot "/etc/apache2"
Mutex file:${APACHE_LOCK_DIR} default 
PidFile ${APACHE_PID_FILE}
Timeout 600
#ProxyTimeout 600 
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5

Пользователь$ {APACHE_RUN_USER} Группа $ {APACHE_RUN_GROUP}

HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf



<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

#<Directory /srv/>
#   Options Indexes FollowSymLinks
#   AllowOverride None
#   Require all granted
#</Directory>




# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
    Require all denied
</FilesMatch>


#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
...