【问题标题】:Proxying requests to Tornado with Apache - 502 Error使用 Apache 代理对 Tornado 的请求 - 502 错误
【发布时间】:2013-02-18 21:55:55
【问题描述】:

试图弄清楚为什么我们的请求会收到502 ProxyError,尤其是在我们的 Python 服务器上处理长时间运行的请求时。

我们的服务器在 CentOS 上,我们使用 httpd 代理 Web 请求,然后将其路由到运行 WSGI REST 应用程序(在端口 8000 上运行)的 Tornado 服务器。

一般情况下,不超过一定时间的请求会成功,但是当请求超时时,完成后我们会得到几个502 ProxyErrors,我们的服务器就没有响应了。我们在将应用程序部署到我们的开发服务器时也看到了这种行为,这些服务器也以相同的方式使用httpd

我们httpd.confVirtualHost的配置是:

<VirtualHost *:80>
    ServerName server_ip
    ServerAlias server
    ServerAdmin admin@server

            DocumentRoot /var/www/

            ErrorLog /var/www/log/error_log

            LogLevel debug

            # Reverse proxy
            ProxyRequests off
            ProxyPass /rest/ http://server_ip:8000/

            # Rewrites
            <Directory />
                            Order allow,deny
                            Allow from all

                            RewriteEngine On
                            #RewriteRule /rest/(.*) http://server_ip:8000/$1 [L,QSA]
            </Directory>
</VirtualHost>

我也在服务器日志中看到这样的条目:

....[error] proxy: HTTP: disabled connection for (server_ip)

什么可能导致这种情况?我们应该在这里使用其他东西(不同的库或配置)吗?

我不确定我在这里提供的信息是否足够,所以如果还有其他有用的信息,请告诉我,我会尽快发布。非常感谢!

【问题讨论】:

    标签: python apache proxy reverse-proxy


    【解决方案1】:

    试试这个

    ProxyPass /rest/ http:// server_ip:8000/ connectiontimeout=5 timeout=30

    将超时更改为最适合您的。

    更多信息http://httpd.apache.org/docs/current/mod/mod_proxy.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-11-25
      • 2018-02-04
      • 2014-09-07
      • 1970-01-01
      • 1970-01-01
      • 2018-08-11
      • 2018-05-23
      相关资源
      最近更新 更多