django 配置 uwsgi 和 nginx 时出现 socket 问题

2015-07-27 10:17:48 +08:00
 aljun

文件:

blogtest_nginx.conf

the upstream component nginx needs to connect to

upstream django {

server unix:///home/aljun/djangotest/blogtest/blogtest.sock; # for a file socket

server 127.0.0.1:8000; # for a web port socket (we'll use this first)
}

configuration of the server

server {

the port your site will be served on

listen 8000;

the domain name it will serve for

server_name .example.com; # substitute your machine's IP address or FQDN
charset utf-8;

max upload size

client_max_body_size 75M; # adjust to taste

Django media

location /media {
alias /home/aljun/djangotest/blogtest/media; # your Django project's media files - amend as required
}

location /static {
alias /home/aljun/djangotest/blogtest/statices; # your Django project's static files - amend as required
}

Finally, send all non-media requests to the Django server.

location / {
uwsgi_pass django;
include /home/aljun/djangotest/blogtest/uwsgi_params; # the uwsgi_params file you installed
}
}

当我执行:

uwsgi --socket :8001 --wsgi-file test.py
得到的却是400 badrequest

但是我的nginx跑起来了,http://localhost:8000/static/github1.css是有反应的

terminal的报错是

invalid request block size: 21573 (max 4096)...skip
求大神帮解答

而且这之前用http就没事,而用了socket就出问题了
我之前是server 127.0.0.1.8001,也是400,才改成的8000的,测试uwsgi过了,用http而不是socket时是可一运行test.py的

2206 次点击
所在节点    问与答
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/208568

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX