【问题标题】:is it neccesary to use nginx or apache for python web in production?在生产中是否需要在 python web 中使用 nginx 或 apache?
【发布时间】:2023-04-01 06:06:01
【问题描述】:

我正在使用 ariadne 和 fastapi 开发一个 graphql api,并考虑在 hypercorn 服务器上启动它。我不必提供静态文件和图像。所以,在我的情况下,在我进行生产时是否有必要使用带有 hypercorn 的 nginx 或 apache2。

注意:- 此服务器上的流量会很大

如果需要使用 apache2/nginx ,如何配置才能与 hypercorn 一起使用?

【问题讨论】:

    标签: nginx apache2 fastapi hypercorn ariadne-graphql


    【解决方案1】:

    历史上 apache2/nginx 被推荐在 Python 服务器之前,因为 Python 服务器一次只能处理一个请求,而 apache2/nginx 可以缓冲请求。参见例如Gunicorn's docs。 Hypercorn(和 Gunicorn 的异步工作者)不是这种情况,因此不需要 apache2/nginx。

    【讨论】:

      猜你喜欢
      • 2018-06-06
      • 2016-08-20
      • 2010-09-16
      • 2017-01-01
      • 1970-01-01
      • 2012-02-24
      • 1970-01-01
      • 2016-05-28
      • 2014-05-17
      相关资源
      最近更新 更多