【问题标题】:django nginx gunicorn config needs to work on ip:portdjango nginx gunicorn 配置需要在 ip:port 上工作
【发布时间】:2018-11-25 05:38:06
【问题描述】:

我目前已经配置了 nginx gunicorn 一切正常我正在构建一个 rest api django 应该像这样 ip:port 工作,但是如果我在浏览器中输入 IP 地址,django 应用程序正在工作,没有使用端口如何将其更改为在指定端口上运行。

【问题讨论】:

    标签: python django nginx django-rest-framework gunicorn


    【解决方案1】:

    你的 nginx 默认使用 80 端口

    端口 80 是分配给常用互联网通信协议超文本传输​​协议 (HTTP) 的端口号。它是计算机从 Web 服务器发送和接收基于 Web 客户端的通信和消息的端口,用于发送和接收 HTML 页面或数据。

    【讨论】:

      【解决方案2】:

      您可以运行 gunicorn 指定端口。在下面的例子中 8000。然后将 nginx 指向它。

      gunicorn application_module --bind=0.0.0.0:8000

      【讨论】:

        猜你喜欢
        • 2021-02-02
        • 2012-05-27
        • 1970-01-01
        • 2014-04-30
        • 2020-05-06
        • 2016-04-20
        • 1970-01-01
        • 2012-11-11
        • 2015-06-22
        相关资源
        最近更新 更多