python - 让 Gunicorn 在 80 端口上运行

标签 python http gunicorn

我用 flask 构建了一个 API。我的应用程序没有任何静态 Assets ,因此我没有理由使用 nginx。

我希望在端口 80 上运行 gunicorn。

我有一个“部署脚本”:

mkdir .log 2> /dev/null
DEBUG=0 gunicorn -b 0.0.0.0:80 backend:app --access-logfile .log/access.log --error-logfile .log/general.log

我希望使用 authbind 在端口 80 上运行 gunicorn。我跟着这个guide这里。

请注意,我可以运行 authbind python -m SimpleHTTPServer 80

当我尝试运行 authbind ./deployment.run 80 时,

我看到以下错误:

2013-04-25 15:32:55 [24006] [ERROR] Can't connect to ('0.0.0.0', 80)
2013-04-25 15:33:08 [24018] [INFO] Starting gunicorn 0.17.4
2013-04-25 15:33:08 [24018] [ERROR] Retrying in 1 second.
2013-04-25 15:33:09 [24018] [ERROR] Retrying in 1 second.
2013-04-25 15:33:10 [24018] [ERROR] Retrying in 1 second.
2013-04-25 15:33:11 [24018] [ERROR] Retrying in 1 second.
2013-04-25 15:33:12 [24018] [ERROR] Retrying in 1 second.

为什么我无法将 gunicorn 绑定(bind)到端口 80?

有什么建议吗?

最佳答案

如果您在类 unix 环境中,端口 < 1024(如 80)将需要 super 用户权限。

关于python - 让 Gunicorn 在 80 端口上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16225872/

相关文章:

http - 使用 Deno 在本地网络上提供文件服务

javascript - 监听网页上的http请求

python - FileNotFoundError : [Errno 2] No such file or directory: 'bash' when running gunicorn server from . 服务文件

python - 如何使用来自同一源的数据嵌套棉花糖模式?

Python3 使用 exec 动态导入 - 为什么 'as' 不被执行?

python - 用于 REST API 的 Marklogic python 库

http - 通过一个 http.ResponseWriter 发送少量响应

python - Django/NGINX/Gunicorn/Ubuntu : Media files - [Errno 13] Permission denied

python - Flask 在通过 Gunicorn 运行时无法在模板文件夹中找到 HTML 文件

python - Pandas 中 lambda 函数内的 Lambda 函数