【问题标题】:connecting nginx and gunicorn together将 nginx 和 gunicorn 连接在一起
【发布时间】:2013-11-20 10:08:35
【问题描述】:

我可以通过在网络浏览器中输入 ip 地址来访问我的网络服务器(nginx),一切正常!现在我安装了 Gunicorn,我希望能够将它与 Django 项目一起使用。我安装了它,它工作正常。根据本教程:http://gunicorn.org/#quickstart 我创建了一个测试代码并运行它。但我的问题是 Gunicorn 如何与 nginx 建立联系?当我在浏览器中输入服务器的 IP 地址时,我看到的是 nginx 默认页面,而不是我创建的这个 python 应用程序?我怎么能看到它?

【问题讨论】:

    标签: python django nginx gunicorn


    【解决方案1】:

    Nginx 充当 reverse proxy server 并将传入的请求交给 Gunicorn。
    Gunicorn 接收来自 Nginx 服务器的请求,处理它们,将结果返回给 Nginx,然后 Nginx 对请求做出响应。

    因此,首先,您必须配置 Nginx 以指示 Nginx 必须将请求交给哪个服务器(ip:port)。配置类似于this。然后你必须配置 Gunicorn 来监听一些端口以及如何处理请求。配置类似于this

    【讨论】:

      猜你喜欢
      • 2012-05-18
      • 2011-10-12
      • 1970-01-01
      • 2022-08-14
      • 2016-04-24
      • 2016-02-23
      • 2021-02-24
      • 1970-01-01
      相关资源
      最近更新 更多