Nginx Ubuntu服务器13.1上发生错误

Nginx Ubuntu服务器13.1上发生错误,ubuntu,nginx,flask,uwsgi,ubuntu-server,Ubuntu,Nginx,Flask,Uwsgi,Ubuntu Server,您好,我目前正在尝试在我通过ssh访问的Ubuntu13.1服务器上使用Flask设置restful api。我认为我已经正确设置了nginx和uwsgi,但是当我在浏览器xxx.xxx.x.xxx中导航到我的IP地址时,我收到了以下消息,而不是经典的nginx欢迎页面: 发生了一个错误。抱歉,您正在查找的页面当前不可用。 请稍后再试。如果您是此资源的系统管理员,则应查看错误日志以了解详细信息 当我检查nginx错误日志时,我看到了以下内容: 2014/03/22 08:51:12 [crit]

您好,我目前正在尝试在我通过ssh访问的Ubuntu13.1服务器上使用Flask设置restful api。我认为我已经正确设置了nginx和uwsgi,但是当我在浏览器xxx.xxx.x.xxx中导航到我的IP地址时,我收到了以下消息,而不是经典的nginx欢迎页面:

发生了一个错误。抱歉,您正在查找的页面当前不可用。 请稍后再试。如果您是此资源的系统管理员,则应查看错误日志以了解详细信息

当我检查nginx错误日志时,我看到了以下内容:

2014/03/22 08:51:12 [crit] 23903#0: *1 connect() to unix:/tmp/uwsgi.sock failed (2: No such file or directory) while connecting to upstream, client: xxx.xxx.x.2xx, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:/tmp/uwsgi.sock:", host: "xxx.xxx.x.1xx"
我遵循的教程如下:

这是我的档案:

/etc/apt/sources.list.d/nginx-lucid.list:

/etc/init/uwsgi.conf

/etc/logd.d/uwsgi

/etc/nginx/conf.d/helloworld.conf

因此,当我使用以下命令重新启动uwsgi时:

sudo service uwsgi restart
我得到这个信息:

stop: Unknown instance: 
uwsgi start/running, process 23969
*** Starting uWSGI 2.0.3 (64bit) on [Sat Mar 22 09:31:52 2014] ***
compiled with version: 4.8.1 on 22 March 2014 08:00:25
os: Linux-3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013
nodename: upsilon
machine: x86_64
clock source: unix
detected number of CPU cores: 8
current working directory: /srv/www/helloworld
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 31452
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on 127.0.0.1:9090 fd 4
spawned uWSGI http 1 (pid: 23989)
uwsgi socket 0 bound to TCP address 127.0.0.1:39396 (port auto-assigned) fd 3
Python version: 2.7.5+ (default, Feb 27 2014, 19:40:54)  [GCC 4.8.1]
Set PythonHome to ./env
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x2667f70
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72752 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
Traceback (most recent call last):
  File "./application.py", line 1, in <module>
    from flask import Flask
ImportError: No module named flask
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 23988, cores: 1)
然后当我试着跑的时候

uwsgi --http 127.0.0.1:9090 --pyhome ./env --module application --callable app
我得到这个信息:

stop: Unknown instance: 
uwsgi start/running, process 23969
*** Starting uWSGI 2.0.3 (64bit) on [Sat Mar 22 09:31:52 2014] ***
compiled with version: 4.8.1 on 22 March 2014 08:00:25
os: Linux-3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013
nodename: upsilon
machine: x86_64
clock source: unix
detected number of CPU cores: 8
current working directory: /srv/www/helloworld
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 31452
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on 127.0.0.1:9090 fd 4
spawned uWSGI http 1 (pid: 23989)
uwsgi socket 0 bound to TCP address 127.0.0.1:39396 (port auto-assigned) fd 3
Python version: 2.7.5+ (default, Feb 27 2014, 19:40:54)  [GCC 4.8.1]
Set PythonHome to ./env
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x2667f70
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72752 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
Traceback (most recent call last):
  File "./application.py", line 1, in <module>
    from flask import Flask
ImportError: No module named flask
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 23988, cores: 1)
ImportError:没有名为flask的模块似乎是主要错误-因此您没有正确激活VirtualNV,或者没有将flask安装到该venv。
uwsgi --http 127.0.0.1:9090 --pyhome ./env --module application --callable app
*** Starting uWSGI 2.0.3 (64bit) on [Sat Mar 22 09:31:52 2014] ***
compiled with version: 4.8.1 on 22 March 2014 08:00:25
os: Linux-3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013
nodename: upsilon
machine: x86_64
clock source: unix
detected number of CPU cores: 8
current working directory: /srv/www/helloworld
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 31452
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on 127.0.0.1:9090 fd 4
spawned uWSGI http 1 (pid: 23989)
uwsgi socket 0 bound to TCP address 127.0.0.1:39396 (port auto-assigned) fd 3
Python version: 2.7.5+ (default, Feb 27 2014, 19:40:54)  [GCC 4.8.1]
Set PythonHome to ./env
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x2667f70
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72752 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
Traceback (most recent call last):
  File "./application.py", line 1, in <module>
    from flask import Flask
ImportError: No module named flask
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 23988, cores: 1)