启动uWSGI实例失败,代码为203 [英] Starting uWSGI instance fails with code 203

查看:437
本文介绍了启动uWSGI实例失败,代码为203的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用nginx和uWSGI在Ubunut 16.04上部署我的Flask应用程序,但是每当我执行sudo systemctl启动nebulon时,我都不会收到错误消息,但是状态显示以下内容:

I want to deploy my Flask app on Ubunut 16.04 with nginx and uWSGI but whenever I do sudo systemctl start nebulon I don't get an error but the status says the following:

nebulon.service - uWSGI instance to serve nebulon
   Loaded: loaded (/etc/systemd/system/nebulon.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2017-09-16 18:08:35 UTC; 5s ago
  Process: 18718 ExecStart=/nebulonapp/nebulon.sock --ini /nebulonapp/nebulon.ini (code=exited, status=203/EXEC)
 Main PID: 18718 (code=exited, status=203/EXEC)

nebulon.service:

nebulon.service:

[Unit]
Description=uWSGI instance to serve nebulon
After=network.target

[Service]
User=nebulonuser
Group=www-data
WorkingDirectory=/nebulonapp
ExecStart=/nebulonapp/nebulon.sock --ini /nebulonapp/nebulon.ini

[Install]
WantedBy=multi-user.target

/nebulonapp中,我有nebulon.ini:

In /nebulonapp I have the nebulon.ini:

[uwsgi]
chdir=/nebulonapp/
wsgi-file = wsgi.py
callable = app
plugin=python35

master = true
processes = 5

socket = nebulon.sock
chmod-socket = 666
vacuum = true

die-on-term = true

nebulon.sock/nebulonapp中,但为空. uWSGI的状态如下:

The nebulon.sock is in /nebulonapp but it is empty. The status of uWSGI is the following:

uwsgi.service - LSB: Start/stop uWSGI server instance(s)
   Loaded: loaded (/etc/init.d/uwsgi; bad; vendor preset: enabled)
   Active: active (exited) since Sat 2017-09-16 18:22:53 UTC; 10s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 18828 ExecStop=/etc/init.d/uwsgi stop (code=exited, status=0/SUCCESS)
  Process: 18854 ExecStart=/etc/init.d/uwsgi start (code=exited, status=0/SUCCESS)

Sep 16 18:22:53 nebulon systemd[1]: Stopped LSB: Start/stop uWSGI server instance(s).
Sep 16 18:22:53 nebulon systemd[1]: Starting LSB: Start/stop uWSGI server instance(s)...
Sep 16 18:22:53 nebulon uwsgi[18854]:  * Starting app server(s) uwsgi
Sep 16 18:22:53 nebulon uwsgi[18854]:    ...done.
Sep 16 18:22:53 nebulon systemd[1]: Started LSB: Start/stop uWSGI server instance(s).

尽管可以使用以下命令测试uWSGI.

Testing uWSGI with the following command works though.

uwsgi --socket 0.0.0.0:5000 --plugin-python3 --protocol=http -w wsgi:app

感谢您的帮助.

推荐答案

问题出在权限上.您从数字海洋中获得的指南缺少关键的步骤-nginx使用www-data组创建套接字,因此您需要将项目文件夹的所有权授予该组,并确保您正在执行的用户与是其中的一部分.

The issue is with permissions. The guide you are following from digital ocean is missing a crucial step - nginx uses the www-data group to create the socket, and because of that you need to give ownership of your project folder to that group and make sure the user you are executing with is a part of that.

只需运行这两个命令

chown -R sammy:www-data /home/sammy/<project>/*

usermod -aG www-data sammy

这篇关于启动uWSGI实例失败,代码为203的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆