
web页面出现Internal Server Error,查看错误日志提示: 2015/02/18 19:51:12 [error] 810#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: xx.xx.xx.xx, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8000", host: "xx.xx.xx.xx"。求解所方法。
1 dingyaguang117 2015-02-20 14:15:56 +08:00 uwsgi配置贴一下 |
2 surefire 2015-02-20 15:22:33 +08:00 8000端口没开吧 |
4 ffx0s OP server { listen 80; server_name 121.40.90.156; access_log /mydata/www/log/access.log; error_log /mydata/www/log/error.log; #charset koi8-r; #access_log logs/host.access.log main; location / { root /mydata/www; include uwsgi_params; # uwsgi_pass 127.0.0.1:9090; uwsgi_pass 127.0.0.1:8000; # uwsgi_param UWSGI_PYHOME /mydata/www/; # uwsgi_param UWSGI_SCRIPT /mydata/www/; # uwsgi_param UWSGI_CHDIR /mydata/www/; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location /static/ { alias /mydata/www/kisspy/static/; index index.html index.htm; } location /media/ { alias /mydata/www/kisspy/static/media/; } } |
5 ffx0s OP @dingyaguang117 <uwsgi> <socket>127.0.0.1:8000</socket> <listen>80</listen> <master>true</master> <pidfile>/var/run/nginx.pid</pidfile> <processes>8</processes> <pythonpath>/mydata/www</pythonpath> <module>wsgi</module> <profiler>true</profiler> <memory-report>true</memory-report> <enable-threads>true</enable-threads> <logdate>true</logdate> <limit-as>300</limit-as> <daemonize>/mydata/www/log/django.log</daemonize> </uwsgi> |
6 imlonghao 2015-02-20 15:37:56 +08:00 via Android <listen>80</listen> |
7 ffx0s OP 主机是阿里云的。奇怪的是把磁盘快照回滚到环境部署好的。还是会出现这个问题。 |
8 imlonghao 2015-02-20 15:43:37 +08:00 via Android <pidfile>/var/run/nginx.pid</pidfile> <listen>80</listen> uwsgi的配置为什么要这样写? |
9 imlonghao 2015-02-20 15:52:17 +08:00 via Android 贴一下uwsgi的配置看看? |
10 imlonghao 2015-02-20 15:52:31 +08:00 via Android 更正,日志 |
11 imlonghao 2015-02-20 15:53:00 +08:00 via Android /mydata/www/log/django.log |
12 tonghuashuai 2015-02-20 16:06:24 +08:00 <daemonize>/mydata/www/log/django.log</daemonize> 这个地方用 uwsgi 自己的日志文件 <pidfile>/var/run/nginx.pid</pidfile> 这个地方不应该用 nginx.pid |
13 ffx0s OP @tonghuashuai <pidfile>/var/run/nginx.pid</pidfile>用什么? |
14 ffx0s OP @imlonghao django.log: {address space usage: 14348288 bytes/13MB} {rss usage: 4497408 bytes/4MB} [pid: 1340|app: -1|req: -1/22] 101.233.154.251 () {42 vars in 657 bytes} [Fri Feb 20 16:22:58 2015] GET /favicon.ico => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0) Fri Feb 20 16:22:59 2015 - --- no python application found, check your startup logs for errors --- {address space usage: 14348288 bytes/13MB} {rss usage: 4497408 bytes/4MB} [pid: 1345|app: -1|req: -1/23] 101.233.154.251 () {44 vars in 737 bytes} [Fri Feb 20 16:22:59 2015] GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0) Fri Feb 20 16:22:59 2015 - --- no python application found, check your startup logs for errors --- {address space usage: 14348288 bytes/13MB} {rss usage: 4497408 bytes/4MB} [pid: 1347|app: -1|req: -1/24] 101.233.154.251 () {42 vars in 657 bytes} [Fri Feb 20 16:22:59 2015] GET /favicon.ico => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0) |
15 dingyaguang117 2015-02-20 19:01:02 +08:00 via iPhone 汗,楼主从哪儿抄的配置 |
16 msg7086 2015-02-20 19:11:46 +08:00 via iPhone <socket>127.0.0.1:8000</socket> <listen>80</listen> <pidfile>/var/run/nginx.pid</pidfile> 我一个不懂python的人都知道这3句都有问题。 |
17 imlonghao 2015-02-20 19:34:30 +08:00 @msg7086 <socket>127.0.0.1:8000</socket> 这个是没问题的,不过下面两句真的不敢恭维 |
18 imlonghao 2015-02-20 19:37:11 +08:00 no python application found, check your startup logs for errors |
19 imlonghao 2015-02-20 19:45:17 +08:00 我有理由相信你的 <module>wsgi</module> 配置错误 这是我的配置文件,您可以参考一下 https://github.com/esdcc/esd.cc/blob/master/esdcc.xml#L6 这一行所写的 wsgi 对应的是 https://github.com/esdcc/esd.cc/blob/master/wsgi.py 测试如下,我将我的这个配置改成<module>1213wsgi</module> (一个没有对应文件的) 出现了和你类似的问题 500 ![]() Log ![]() |
20 imlonghao 2015-02-20 19:51:08 +08:00 |
21 ffx0s OP @imlonghao 头疼。。服务器一些配置不怎么会,这些配置就是网上找的,话说python也只是刚开始学,还是得继续努力,谢谢你了。 |
22 ffx0s OP @dingyaguang117 配置网上找的。对python感兴趣就学了。其实我是前端。。 |
23 ffx0s OP @dingyaguang117 网上抄的。 |
24 imlonghao 2015-02-20 21:29:00 +08:00 |
25 tonghuashuai 2015-02-21 09:39:51 +08:00 @ffx0s 新建一个 uwsgi.pid |
26 surefire 2015-02-22 17:22:20 +08:00 |
27 lsdvincent 2015-02-22 18:57:44 +08:00 胆战心惊贴个自己的Blog http://blog.breakwire.me/blog/20150208/ 绝对跑得起来,跑不起来楼主凑我! |
28 tolerious 2015-03-02 09:55:54 +08:00 via iPhone 把listen那个去掉,不是已经8000端口转发了么? |
29 1130335361 2015-04-02 22:42:06 +08:00 @lsdvincent 1.logs下面的access.log和error.log是文件还是文件夹?2.需要自己建立吗 |
30 lsdvincent 2015-04-03 00:22:25 +08:00 via iPhone @1130335361 是文件;logs 文件夹要自己建立 |
31 lsdvincent 2015-04-03 00:23:05 +08:00 via iPhone @lsdvincent 只要建那个logs文件夹就行 |