【问题标题】:Flask uWSGI and Nginx : systemctl status myproject : FAILED烧瓶 uWSGI 和 Nginx:systemctl status myproject:失败
【发布时间】:2021-09-10 21:09:37
【问题描述】:

首先,我已经在机器上运行了一个类似的 Python flask web 服务器

我正在关注this tutorial,以便使用 Python Flask 托管 Web 服务器。 在第五步(到目前为止没问题),当我测试时:

systemctl status myproject

我明白了

serveurB.service - uWSGI instance to serve serveurB
 Loaded: loaded (/etc/systemd/system/serveurB.service; enabled; vendor preset: enabled)
 Active: failed (Result: exit-code) since Mon 2021-06-28 14:25:45 UTC; 1min 53s ago
Process: 7992 ExecStart=/home/sydney/serveurB/serveurB/bin/uwsgi --ini serveurB.ini 
(code=exited, status=1/FAILURE)
Main PID: 7992 (code=exited, status=1/FAILURE)

Jun 28 14:25:45 ecocathlon uwsgi[7992]: detected binary path: /home/sydney/serveurB/serveurB/bin/uwsgi
Jun 28 14:25:45 ecocathlon uwsgi[7992]: !!! no internal routing support, rebuild with pcre support !!!
Jun 28 14:25:45 ecocathlon uwsgi[7992]: your processes number limit is 3789
Jun 28 14:25:45 ecocathlon uwsgi[7992]: your memory page size is 4096 bytes
Jun 28 14:25:45 ecocathlon uwsgi[7992]: detected max file descriptor number: 1024
Jun 28 14:25:45 ecocathlon uwsgi[7992]: lock engine: pthread robust mutexes
Jun 28 14:25:45 ecocathlon uwsgi[7992]: thunder lock: disabled (you can enable it with --thunder-lock)
Jun 28 14:25:45 ecocathlon uwsgi[7992]: bind(): Permission denied [core/socket.c line 230]
Jun 28 14:25:45 ecocathlon systemd[1]: serveurB.service: Main process exited, code=exited, status=1/FAILURE
Jun 28 14:25:45 ecocathlon systemd[1]: serveurB.service: Failed with result 'exit-code'.

其中

myproject = serveurB
myprojectenv = serveurB (yes same name, i misstyped that one but i don't think it is the issue)
user = sydney

我之前的所有步骤和文件似乎都是正确的。

提前致谢, 悉尼 R.

【问题讨论】:

    标签: python nginx flask digital-ocean uwsgi


    【解决方案1】:

    他们在错误信息中的关键行是这个:

    Jun 28 14:25:45 ecocathlon uwsgi[7992]: bind(): Permission denied [core/socket.c line 230]
    

    bind 是将您的套接字“绑定”到端口以进行侦听的方法,并且您收到“权限被拒绝”错误。这意味着您使用的是低编号端口 (

    我建议将端口更改为高于 1024 的端口,因为以 root 身份运行应用程序可能很危险。还有其他解决方案,但它们超出了此答案的范围。

    【讨论】:

    • 确实,我明白为什么这可能是问题所在。如何将端口更改为高于 1024 的端口?也可能是因为我的其他网络服务器默认在同一个端口上吗?我不知道这是在哪里指定的。提前致谢,
    【解决方案2】:

    在数字海洋上设置项目时,您必须注意命名。确保您没有收到任何命名错误的最佳方法是使项目名称与项目以及设置服务器时保持一致。为此,我建议您仔细检查您的 nguni 服务文件,看看您是否确实引用了您的 uWSGI 项目。

    【讨论】:

    • 我会试试的!感谢您的回答
    猜你喜欢
    • 2012-11-28
    • 2018-02-02
    • 1970-01-01
    • 1970-01-01
    • 2014-04-07
    • 1970-01-01
    • 1970-01-01
    • 2017-11-16
    • 2014-04-11
    相关资源
    最近更新 更多