简体   繁体   English

uwsgi从控制台工作,但不是ini

[英]uwsgi works from console but not ini

I am trying to setup graphite with nginx. 我正在尝试使用nginx设置石墨。 Because of this I need to run it using a configuration or ini file in /etc/uwsgi, but I am unable to get the application to start correctly. 因此,我需要使用/ etc / uwsgi中的配置或ini文件来运行它,但是我无法使应用程序正确启动。

Using, the command, 使用命令

uwsgi --http :9090 --wsgi-file /opt/graphite/conf/graphite.py

Graphite starts and runs fine, I can navigate it and look at stats. 石墨启动并运行良好,我可以对其进行浏览并查看统计信息。

I proceeded to create an ini file, with the contents: 我着手创建一个ini文件,内容如下:

[uwsgi]
processes = 2
socket = localhost:8081
gid = nginx
uid = nginx
chdir = /opt/graphite/conf
uswsgi-file = graphite.py

running the ini file I see: 运行ini文件,我看到:

mapped 145536 bytes (142 KB) for 2 cores
*** Operational MODE: preforking ***
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***

I can only guess it something is misconfigured here in the ini file but I am not seeing what it is. 我只能猜测它在ini文件中配置错误,但是我看不到它是什么。

Any help is appreciated! 任何帮助表示赞赏!

There are some differences between your command line and ini file: 您的命令行和ini文件之间有一些区别:

  1. you're using socket instead of http inside ini. 您在ini中使用socket而不是http That means, uWSGI server will talk using uwsgi protocol instead of http. 这意味着,uWSGI服务器将使用uwsgi协议而不是http进行对话。 If you're using uwsgi_pass in nginx and trying to access your website from browser through that nginx, it's fine. 如果您在nginx中使用uwsgi_pass并尝试通过该nginx从浏览器访问您的网站,那很好。 But if you're trying to access uwsgi directly from browser, bypassing nginx, you won't succeed because browsers doesn't talk uwsgi. 但是,如果您尝试绕过nginx直接从浏览器直接访问uwsgi,则不会成功,因为浏览器不会讲uwsgi。

  2. You've put uswgi-file instead of wsgi-file into your config. 您已将uswgi-file而不是wsgi-file放入配置中。 That won't work at all and uwsgi won't be able to find your wsgi file. 那根本行不通,uwsgi将无法找到您的wsgi文件。 And if you're chdiring into directory with your wsgi file, it is better to use: 而且,如果要使用wsgi文件将目录写入目录,最好使用:

     module = wsgi 

    instead of wsgi-file . 而不是wsgi-file

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM