uwsgi 总是绑定到 80 端口。即使配置为不

uwsgi always binds to 80 port. Even when configured not to

我正在尝试启动 uwsgi 侦听自定义 8008 端口。如 security section of uwsgi docs 中所述,我使用 uidgid 参数从 www-data 用户

uwsgi --http-socket :8008 --uid=www-data --gid=www-data

但我不断收到错误消息

bind(): Permission denied [core/socket.c line 769]

跟踪这个问题后,我发现 uwsgi 尝试绑定到 80 端口,即使我选择另一个端口也是如此。

经过多次尝试,它似乎总是绑定到80端口。连同我选择的端口。

例如(运行 作为 root)

的输出
uwsgi --http-socket :8008

包含

thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address :80 fd 3
uwsgi socket 1 bound to TCP address :8008 fd 4
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***

环境变量配置的另一个例子:

UWSGI_SOCKET=:8009 uwsgi --http-socket :8008

产生

thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address :8009 fd 3
uwsgi socket 1 bound to TCP address :80 fd 4
uwsgi socket 2 bound to TCP address :8008 fd 5
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***

它总是尝试绑定到第 80 个端口,如果从非 root 用户进行绑定,则合理地失败

在 docker 中使用 uwsgi 2.0.17.1 在 Ubuntu 17.10 下做所有的事情 尝试从 debian 软件包和 python pip3 安装 uwsgi - 相同的行为。

关于我遗漏的任何想法? 提前致谢。

怎么样:

uwsgi --http 127.0.0.1:80 --uid=www-data --gid=www-data

终于明白是怎么回事了。 我的 docker-compose.yml 文件中的配置有误。

environment:
  UWSGI_HTTP_SOCKET: :80

这就是问题所在。