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

问题描述 投票:0回答:2

我正在尝试启动uwsgi监听自定义8008端口。正如在security section of uwsgi docs中提到的,我使用uidgid params从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) ***
  • 无论如何配置它:通过cli-params,.yml-file或环境变量。
  • 无论选择什么参数http-sockethttp或只是socket
  • 无论如何指向该端口:0.0.0.0:8008或只是:8008(甚至UNIX套接字)

它始终尝试绑定到第80个端口,如果从非root用户执行此操作,则会合理地失败

使用uwsgi 2.0.17.1在Docker中使用Ubuntu 17.10进行所有操作尝试从debian软件包和python pip3安装uwsgi - 相同的行为。

我缺少什么想法?提前致谢。

sockets binding port uwsgi
2个回答
0
投票

关于什么:

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

0
投票

最后我想出了发生了什么。我在docker-compose.yml文件中配置错误。

environment:
  UWSGI_HTTP_SOCKET: :80

那就是问题所在。

© www.soinside.com 2019 - 2024. All rights reserved.